Concepts / Getting insights and analytics / Which events should I collect?
Apr. 28, 2019

Which Events Should I Collect?

What is an Event?

Every insight and analytics metric is based on the same information: an event that is tied to a user action. For any insight or analytic feature to work - whether it be to track click behavior or create user preferences or perform A/B testing - you always need to do the same thing: collect an event.

For every distinct event, there is always a single line of code that asks for information relevant to the goal you want to achieve. A quick example is click analytics: you need to send Algolia the click details, namely, which search created the results, which item the user clicked on, and in what position in the result list. For user preferences, it’s almost the same, but you’ll need to add a user identification along with some other relevant information that helps give the preference some context.

So the main concerns regarding event capturing is where you place the code and what parameters you send to Algolia.

Using Events to capture user behavior and preferences

To make all that possible, Algolia has set up an event-capturing mechanism that allows you to collect user behavior. Event capturing is flexible, and each one has its own unique context.

For example, some events are meaningful only within the context of a search.

  • which items users click on,
  • what filters they use,
  • and where they go after searching.

Some events can be product-related, meaning that you can track the users preferences for certain products.

  • what brands they prefer,
  • what colors and other such category-based data they favor,
  • and what specific items they prefer or buy.

Thus, Algolia needs to collect different kinds of events to achieve one or more of these goals. For example, if you want to know the most popular words that your users are typing, Algolia needs to store every query. If you want to know how many results a query generates, Algolia needs to store the count of records in every result set, along with the query string that generated the results. And if you want to know which items users click on, and in what position, you need to send that too.

Gathering User Events Through Insights

Insights events (click, conversion, view) used for analytics and/or personalization do not take immediate effect. The delay can range from 10 to 60 minutes depending on how long after the search they are sent. For precise times, see our page on when Insights events take effect.

There are 2 kinds of events to capture:

1- Capturing actions on an item

Action-based events include bookmarking an item, viewing a product page, putting a product on a wish list or shopping cart, buying a product, reading an article, and many other events that you consider useful in defining user preferences. For this to work, you need to make sure that these events are captured every time they occur.

Here’s what you need to send:

  • The user
  • The event type of the action
  • The action taken by the user
  • The item on which the action was taken

2- Capturing actions on categories (facets)

You can send events related not only to a particular item but to a group of items, identified by a filter. For this, you send the filter along with its associated action. For example, if a user visits the category page “Electronics” of an e-commerce website, it could be interesting to capture this as a filter event, to boost this category as an insight.

Here’s what you need to send:

  • The user
  • The event type
  • the action taken
  • The filter you consider relevant to the action taken

Note: For this to work, the filter has to be set up as an attribute for faceting.

Facet events don’t have to be linked to the selection of a facet in the UX. One scenario is when sending a campaign targeting a specific brand or product type. If a user clicks on the campaign, the customer could send a facet event with the brand “Apple” or product type “tablet”.

To conclude, you should send user actions that you consider relevant to building an understanding of your user’s preferences. These events can be either their interactions with the items in your index, or with a group of items identified by a filter.

Examples of events worth tracking

View

  • A user viewed a product page
  • A user viewed a landing page of all Apple products

Clicks

  • A user clicked on a item on the home page
  • A user clicked on a item on a category page
  • A user clicked on a item on a newsletter email
  • A user clicked on a search result
  • A user clicked on a filter as they search
  • A user clicked on a menu item related to a filter

Conversions

  • A user bookmarked, or liked, or recommended an object
  • A user added to cart, or purchased an item
  • A user watched a video, read an article
  • A user followed a playlist, an author, a brand

List of objects

Also, each of the events related to an object also accepts a list of objects. For example, it is possible to send a “purchase” event containing the list of objects that were purchased together.

Did you find this page helpful?