Click and conversion events
To analyze how users are interacting with your search experience in your Magento installation, you can track clicks and conversions. In both the Autocomplete and Instant Search Results page, you can track which products are clicked more often, and which searches have the highest conversion rate.
To enable click and conversion analytics, go to Stores > Configuration > Algolia Search > Click & Conversion Analytics.
Enable click analytics
Set Enable Click Analytics to Yes to turn on click and conversion analytics.
This adds the parameter clickAnalytics=true
to every search.
The default for this setting is No.
DOM selector of a result container on instant search page
Enter a DOM selector for the search results container to define which elements on your page are tracked.
The elements selected must have the data-objectid
and data-position
attributes.
This default DOM selector is .ais-Hits-item a.result, .ais-InfiniteHits-item a.result
.
Conversion analytics mode
Select between Disabled, Add to cart, or Place order to define which event is considered a conversion.
To be considered a conversion, a user must have interacted with your search at least once during the session for the product being considered.
To connect searches to conversion events, the Algolia extension adds URL parameters for the queryID
, objectID
, and indexName
parameters.
You need to include these parameters for your clicks and conversions to work.
For better SEO, you should use canonical link meta tags for your product pages.
To enable canonical links, go to Stores > Configuration > Catalog > Catalog and set Use Canonical Link Meta Tag For Products to Yes.
If you’re using an alternative method to track the queryID
, objectID
, and indexName
parameters for your conversion events,
you can remove the URL parameters by editing the
common.js
file.
Conversion analytics mode | Description |
---|---|
Disabled | This is the default mode. No conversions are tracked. |
Add to cart | A conversion event is triggered as soon as a user clicks the Add to cart button. This can either be on the search results or the product page. |
Place order | A conversion event is triggered when a user lands on the Checkout Successful page. |
DOM selector of Add to cart buttons
Enter a selector for the Add to cart button if the conversion analytics mode is set to Add to cart.
The elements targeted by this selector must have the data-objectid
attribute (unique product identifier).
The default is .action.primary.tocart
.