Best Practices for Sending Click and Conversion Events
For click analytics to be reliable, you need to be consistent. Every click and conversion must be tracked properly. This means that every relevant event must be captured, otherwise the data won’t be complete or accurate.
The goal is to choose a single kind of conversion event and make sure this event is always captured. You also want to make sure that no other kind of event is captured. Algolia only tracks one kind of conversion per index. It can be “putting an item in the shopping cart” or “liking an item”; if you try to capture both events on a given search, you will never know which one was done or whether both were done.
Sending a Conversion event means that a search has converted. In this sense, Conversion = Yes or No, per search, it does not save any more detail. It doesn’t accumulate conversion events; for example, “liking an item” + “adding it to the shopping cart” do not make Conversion = 2 but only conversion = Yes.
In general, when you want to see if a search has converted, you need to be clear in your mind what that conversion is.
How to name your events
To get the most from Algolia Analytics, you should establish a consistent naming convention for your events, from day one.
A good event naming scheme makes it easier for you and your team to:
- leverage analytics data for Personalization,
- understand the associated action for each of your events,
- maintain a clean and readable codebase.
If you use analytics services in addition to Algolia Analytics, it is especially important to adopt a consistent naming convention. If you don’t, aggregating your analytics data will be difficult. We strongly recommend the following practices:
- use the Object Action Framework (name events according to their interacted object and interaction type: ex. Product Viewed),
- keep your event names simple,
- make your event names readable for non-tech people,
- use “Proper Case” for event names (every word should be capitalized),
- use “snake_case” for event properties (every word is lowercase and connected by an underscore).
This section lists strong recommendations not requirements. There are only two requirements for event names: they must be at most 64 characters long and they must contain only ASCII characters.
To see what our recommended naming conventions look like in practice, check out our example events page
Some other points to consider
- Because you will be recording country-based information, you need to make sure you send us the relevant IP. Therefore, when doing back-end search, make sure to forward the IP of the end user. Otherwise Algolia will see the queries coming from only one location - the location of your back-end server.
- Given the “as-you-type” nature of Algolia search, if your user types 5 characters, this will generate 5 queries and therefore 5 Query IDs. In that case, you must use the last query ID. See query aggregation for more on this point.
- If a user gets to a conversion point without having first used your search bar - for example, via Google, or an external hyperlink - this is not a conversion. Let’s say adding an item to a shopping cart is your defined conversion, it should be marked as a conversion only if it has followed the Algolia search. Keep in mind that we are tracking site search-to-conversion, so only search-derived conversions matter.