🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
Integrations / Shopify

Shopify Algolia global 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 InstantSearch and Autocomplete libraries emit global events. You can’t pass data to the global events but you can listen to them.

  • algolia.autocomplete.beforeInit is emitted before the Autocomplete library is initialized
  • algolia.autocomplete.afterInit is emitted after the Autocomplete library is initialized
  • algolia.autocomplete.hitClickAction is emitted when a user clicks on an Autocomplete result
  • algolia.instantsearch.beforeInit is emitted before the InstantSearch library is initialized
  • algolia.instantSearch.afterInit is emitted after the InstantSearch library is initialized
  • algolia.instantsearch.hitClickAction is emitted when a user clicks on an InstantSearch result
  • algolia.instantSearch.onError is emitted when the InstantSearch library. reports an error
  • algolia.instantSearch.onRender is emitted when all InstantSearch widgets have been rendered
  • algolia.instantsearch.beforeInitSortOrders is emitted before InstantSearch sorting is initialized
  • algolia.instantsearch.beforeInitFacets is emitted before InstantSearch facets are initialized
  • algolia.hooks.initialize is emitted before Algolia hooks have been initialized
  • algolia.analytics.beforeInit is emitted before the Algolia Insights API has been initialized

Example

1
2
3
document.addEventListener('algolia.autocomplete.afterInit', function() {
  console.log("Autocomplete.js has been initialized")
});
Did you find this page helpful?