Insights hooks
The following hooks change aspects of the Insights integration for sending click and conversion events.beforeAlgoliaAnalyticsOptions
Changes options for the Insights library.
Parameters
Returns
Modified Insights options.
Examples
Opt out of Insights events
Opt out of Insights events
Set
userHasOptedOut to true to prevent the integration from sending Insights events.JavaScript
beforeAddToCartSelector
Changes the CSS selector for the add-to-cart button.
Parameters
Default CSS selector for the add-to-cart button:
'[name="add"]'.Returns
Modified CSS selector.
Examples
Use a custom add-to-cart selector
Use a custom add-to-cart selector
Return a custom selector if your theme uses a different add-to-cart button.
JavaScript
Recommend hook
This hook changes the behavior of recommendations from Algolia Recommend.beforeRecommendHitTemplate
Customize the HTML template that renders the recommendations panel.
Parameters
_defaultTemplate
Default template.
html
Tagged template function for rendering HTML.
Recommendation item.
Returns
template
Template to render.
Examples
Customize the recommendation item template
Customize the recommendation item template
Return a custom HTML template to match your theme’s recommendation card layout.
JavaScript
beforeAddToCartSelectorString (deprecated)
This hook is deprecated.
Use
beforeAddToCartSelector instead.Parameters
CSS selector.
Returns
CSS selector.