When we calculate sum of queries we simply look at each user and count all unique queries they have done during their sessions. We do this for all users and then summarize it, and that will be the total query count. This means that we count unique queries per user per session.
The % of clicks = total number of click events per user per session / unique searches. This means that two clicks on one unique search = 200% click rate. Same goes for the added to cart and purchase rate calculations.
We also keep track of the activity of the user in terms of sessions. A session is created when the user starts using the API. If the user is inactive for more than 1 hour it is closed.
If we get an event on a product that has been shown to the user through a search in the same session, we connect the two.
12:00 /Search query=shoe page=1 userid=AAA (counted, new query)
12:02 /Search query=shoe page=2 userid=AAA (repeat)
12:04 /Search query=shoe page=1 userid=AAA facet=sneakers (repeat)
12:05 /Search query=shoe page=1 userid=AAA (repeat)
12:20 /Search query=nike page=1 userid=AAA (counted, new query)
12:20 /Search query=shoe page=1 userid=BBB (counted, other user)
12:22 /Search query=shoe page=2 userid=BBB (repeat)
12:24 /Search query=shoe page=1 userid=BBB sort=price (repeat)
14:06 /Search query=shoe page=1 userid=AAA (counted, new session)
14:07 /Search query=sneakers page=1 userid=AAA (counted, new query)
10 API calls, 5 query counts.