how can I know user is typing or pasting in the search field | Community
Skip to main content
Level 2
July 8, 2024
Solved

how can I know user is typing or pasting in the search field

  • July 8, 2024
  • 1 reply
  • 677 views

once we have the search terms, I need to know whether it is typed or pased in the search field. How can we achieve this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jennifer_Dungan

That one is tricky... what if they paste AND type? I assume you don't want to inflate your server calls by sending tracking on each keystroke or paste action (which may not even result in an actual search).

 

Do you plan on tracking "typed" vs "pasted" when the user submits their search? Do you want the last used?

 

So:

  • user pasted then typed, so send just "typed"?
  • or do you want to know if there was a mixed usage, so send "pasted and typed"?
  • what happens if the user types, deletes everything they typed, then pastes?
  • what happens is the user pastes over what they typed?
  • what happens if the user types over what they pasted?
  • what about accessible technologies? i.e. user has data type via voice input? There is no keyboard interaction in this scenario....

 

If you use the last interaction, that's easier... but may not provide the detail you need...  but if you try to track a combined usage you can see how complex this might get... 

 

All of this would require custom JS to detect Key Presses (which wouldn't work for assistive technologies, and storing / updating at each use, to then read/pull when the search is submitted.... 

 

While I am not going to presume to know why this is important to you / your business... it might be worth having a discussion about whether this particular use case is worth the complexities (which still may not be able to capture all scenarios with 100% accuracy any way)

 

 

1 reply

Jennifer_Dungan
Community Advisor and Adobe Champion
Jennifer_DunganCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
July 8, 2024

That one is tricky... what if they paste AND type? I assume you don't want to inflate your server calls by sending tracking on each keystroke or paste action (which may not even result in an actual search).

 

Do you plan on tracking "typed" vs "pasted" when the user submits their search? Do you want the last used?

 

So:

  • user pasted then typed, so send just "typed"?
  • or do you want to know if there was a mixed usage, so send "pasted and typed"?
  • what happens if the user types, deletes everything they typed, then pastes?
  • what happens is the user pastes over what they typed?
  • what happens if the user types over what they pasted?
  • what about accessible technologies? i.e. user has data type via voice input? There is no keyboard interaction in this scenario....

 

If you use the last interaction, that's easier... but may not provide the detail you need...  but if you try to track a combined usage you can see how complex this might get... 

 

All of this would require custom JS to detect Key Presses (which wouldn't work for assistive technologies, and storing / updating at each use, to then read/pull when the search is submitted.... 

 

While I am not going to presume to know why this is important to you / your business... it might be worth having a discussion about whether this particular use case is worth the complexities (which still may not be able to capture all scenarios with 100% accuracy any way)

 

 

Level 2
July 8, 2024

Thank you so much the detail explanation, this helps a lot.