Algolia
This guide shows how to integrate Topsort auction results with your existing Algolia index, allowing organic and promoted products to be listed in the same flow.
Algolia is a powerful search engine that provides fast and relevant results for navigating catalogs. By integrating Algolia with Topsort, we can sync your catalog directly into Topsort, without needing extra catalog integrations. The integration will also enable you to prioritize promoted products in the organic results returned by Algolia. Check Topsort’s Proxy integration for more details.
How it Works
-
To integrate Topsort with Algolia, make sure you comply with these prerequisites:
- Your product catalog is stored in an Algolia index.
- You are querying Algolia using the Algolia SDK.
-
Create an Algolia API key with the following permissions: search, browse, listIndexes (additional permissions like addObject and deleteObject may be needed depending on how you manage your index updates).
- The browse permission enables downloading of your entire catalog.
- The listIndexes permission allows Topsort to check the index’s last modification date to avoid unnecessary updates
-
Share index details with Topsort: Contact Topsort support and share your Algolia index name. This allows Topsort to configure and start importing your catalog.
-
Configure Topsort Proxy: Update your Algolia SDK configuration to point to Topsort’s Proxy. This will allow Topsort to prioritize promoted products in the organic results returned by Algolia.
import algoliasearch from 'algoliasearch/lite';const client = algoliasearch('YourApplicationID', 'YourWriteAPIKey', {hosts: [{ url: 'myslug-sandbox.topsort.workers.dev' }],});const index = client.initIndex('your_index_name');
Auction Results and Event Tracking
The promoted products prioritized in the response of Topsort’s Proxy will have a resolvedBidId parameter that uniquely identifies that product’s auction. You can use it to visually mark the product as “Promoted” for the end use.
The resolvedBidId is also needed to identify the auction winner when reporting events (impressions, clicks, purchases). Check our Events Tracking documentation for more detail.