Why do analytics "search" events lag behind actions performed in my search interface?
Searches performed in the search UI aren’t reflected right away in the search analytics tables and charts.
Analytics events in generated search interfaces are only sent once we can be sure that a search session has ended. We decide this using a number of triggers:
The user clicks a result.
The user deletes the entered query.
The user changes any of the first 3 letters of the query.
The user leaves the search results page.
Only one "search" event will be sent, even if more than one of the triggers is fired.
By default our search interfaces perform queries on every keypress. Reporting analytics "search" events for each of these would be incorrect.
For instance, where a user is trying to search for "product", firing analytics events for each query would result in recorded searches for "p", "pr", "prod", ..., and finally "product". Actually, we would just want an event for "product", which would represent that search session rather than individual queries that were run.
In practise this means that we wait until we're received a signal that the user has finished with a search session before we send the analytics event.