Integrations / Salesforce Commerce Cloud B2C

Click and conversion events

The integration can capture different events and enable advanced search features. Events are sent by the frontend cartridges:

  • SFRA sites emit events from the int_algolia_sfra cartridge.
  • SiteGenesis sites emit events from the int_algolia_controllers cartridge.

Find statistics about these events in the Algolia dashboard.

Sending events enables you to use these features:

Default events

By default, Algolia captures every keystroke in the search box to provide detailed analytics. The cartridge can also capture view, click, and conversion events when users add a product to their cart or complete a purchase.

To start capturing events, select Enable insights events in the integration’s Business Manager module (Business Manager > Merchant Tools > Algolia > Algolia). Event behavior depends on the cartridge you use.

You can also enable basic click and view events on InstantSearch and Autocomplete-powered pages and components such as search results, category landing pages, or the search box with an Algolia dashboard setting. However, since this doesn’t enable additional conversion events triggered on pages such as the product detail page or the cart, you should use the Salesforce B2C cartridge-specific setting on the Business Manager.

SFRA

When enabled, the SFRA cartridge sends the following events:

Keeping track of users and search queries for conversion events

To provide better insights, the conversion events sent should ideally contain a persistent userToken and the ID of the search query that led to them. The SFRA cartridge has mechanisms to keep track of those.

queryID

If the cartridge can get the queryID of the search that triggered a conversion event, it’s sent in the event payload.

  • For add-to-cart events, there are two options:

    • If the action is performed from the Quickview, the queryID comes from the underlying InstantSearch instance.
    • If users click a search result, leading to the product page, the cartridge adds a queryID to the query string URL and uses it when a user adds the product to their cart.
  • Since purchase events don’t relate to a search, you must store each user’s query IDs in their browser’s local storage until the order confirmation page. The cartridge will only do this if a user has agreed to it, using SFRA’s system for tracking consent.

userToken and authenticatedUserToken

The cartridge uses SFCC’s default dwanonymous_ cookie to set the userToken on insights events. For authenticated users, it also relies on the session object to retrieve and set the authenticatedUserToken.

SiteGenesis

When enabled, the SiteGenesis cartridge sends the following events:

  • view and click, sent from Autocomplete, category pages, and the search results page.
  • addedToCartObjectIDsAfterSearch, sent when products are added to the cart.

To implement additional events such as purchase, refer to the Insights client documentation.

PWA Kit

If your frontend is built with the PWA Kit, implement events with React InstantSearch.

Did you find this page helpful?