Click and conversion events
Send click and conversion events to increase discovery and conversions.
The Algolia AI Search & Discovery app lets you track click and conversion events from your Shopify store.
Sending events enables you to use these features:
Before you begin
Algolia AI Search & Discovery supports the default widgets provided by the app. If you’re using custom widgets, see Sending events for more information.
Algolia Search must be enabled on your theme, to get started, see Enable Algolia on your theme.
User token strategy
Events represent an interaction of a user with your store. Algolia relates a user profile to an event through a user token.
You can choose how you want to set the user token:
- With a random alphanumeric string at every page refresh
- Using cookies.
userToken
is set with a random alphanumeric string at every page refresh
This option doesn’t use cookies. Because every page refresh generates a new user token, you can’t identify user profiles across sessions.
userToken
is set using cookies depending on the user’s approval
This option stores the user token in a cookie on the user’s device. You must use Shopify’s Customer Privacy API or enable Shopify’s Cookie Consent Banner in your Shopify admin settings.
If the user hasn’t consented, a random alphanumeric string is used as user token.
Algolia uses Shopify’s loadFeatures
method to check if the user has consented.
User token for Personalization
To personalize your search experience, you need to provide a way to identify user profiles across sessions with a stable user token. For example, you can use the user’s account ID after they signed in to your shop.
To add a stable user token, use custom hooks.
Send events
To track user interactions in your Shopify store and send them to Algolia, you can choose between:
- Use Essentials Analytics: automatically send “click”, “view”, and “search” events to Algolia.
- Use Conversion Analytics: using Shopify web pixels, send “addToCart” and “purchase” conversion events to Algolia.
Shopify web pixels
Shopify web pixels are JavaScript snippets that you can install in your Shopify store to track user interactions and improve your search results. The web pixels collect data about your users’ interactions with your store, such as add-to-cart and purchase events. You can use the data to improve the relevance of your search results and gain insights into your users’ behavior.
To capture events with web pixels, you need to enable the app embed for Algolia Search.
Install Shopify web pixels
-
Go to your Shopify admin and click Settings.
-
Open the Customer events tab.
-
Click Add custom pixel.
-
Name your pixel and click Add pixel.
-
Copy the pixel code and paste it into the Algolia web pixels area in the Code section provided by Shopify.
js -
Click Save, then Connect.
Your Shopify web pixels are now installed and can start tracking user interactions on your store. Make sure that your web pixels show Connected in their status.
-
Go back to your Shopify admin and complete the setup by clicking Activate & Continue.
Was this page helpful?