Integrations / Shopify

Click and conversion events

From December 31, 2023, Algolia’s Search and Discovery application can’t modify the coding of Shopify themes. For more information, refer to Shopify’s Asset API documentation. As an alternative, Algolia offers Shopify’s App Embed and App Blocks features for Autocomplete and InstantSearch interfaces. For more information, refer to the Quick start and Shopify Algolia configuration documentation.

The Algolia Search and 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 Search and 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, steps to enable.

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. If the user hasn’t consented or you don’t use the Customer Privacy API, 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 click events

Since January 2023, the Algolia Search and Discovery app sends click events by default. If you installed the app before January 2023, go to the Settings tab in your Shopify app and select Use click analytics.

With click analytics turned on, the app sends a click event to Algolia when a user clicks a product in the autocomplete menu or on the search results page.

Select your user token strategy and save your changes.

Send click events section in the Shopify admin

Update add-to-cart selector

The default CSS selector is [name="add"]. Although most themes use this selector, some use a different one. If this is the case, modify the beforeAddToCartSelectorString hook.

Did you find this page helpful?