How does Loop54 count Search Queries and connect them to Events and User Sessions?

This article explains how we count events in search, how we connect those events to user and how we determine a user session.

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.

How we count events in search (click, add to cart, purchase):

  1.  A user makes a search. That API call contains a randomly generated UserId.
  2. We find products and send them back to the site (for the user to see), we keep track of what products we send back to that user.
  3. When a user clicks on a product, an event is sent to us through an API call, this API call has the same UserId as the user who clicked on the product.
  4. We can then match the UserId of the event to previous search calls. Since we also know what products have been shown, we can see if the event was sent on any other products that have been shown to that user. 

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.

How we determine a user session

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.

Example:

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.