Skip to content
guides

Integrating Topsort and Algolia

Introduction

Algolia is a powerful search engine that provides fast, relevant results for navigating catalogs. By integrating Topsort, you can monetize your catalog search by including auction-powered listings that promote specific products.

This guide outlines two integration options for Topsort and Algolia:

  1. Option 1: Single-Index Integration: Use your existing Algolia index (primary index) to serve both organic and auctioned products.
  2. Option 2: Dual-Index Integration: Use a separate index (secondary index) for promoted products alongside your organic index.

Each option has different implementation steps, pros, and cons to help you choose the most suitable method for your use case.

Prerequisites

  1. Your catalog is stored in an Algolia index
  2. You have a Topsort account
  3. You are using the Algolia SDK to query your Algolia index
  4. You have an Algolia API key with the required permissions (search, browse, listIndexes, addObject, deleteObject, depending on the integration path chosen)

Integration Steps

  1. Reach out to Topsort with your Algolia index name.

  2. Create an API key with browse and listIndexes permissions so Topsort can access your Algolia index to import your catalog.

    • The browse permission enables efficient, paginated downloading of your entire catalog
    • The listIndexes permission allows Topsort to check the index’s last modification date to avoid unnecessary updates
  3. Topsort Proxy Configuration: You will need to adjust the Algolia SDK to point to the Topsort proxy. The proxy will augment search results with auction data automatically. Example code:

    import algoliasearch from 'algoliasearch/lite';
    const client = algoliasearch('YourApplicationID', 'YourWriteAPIKey', {
    hosts: [{ url: 'myslug-sandbox.topsort.workers.dev' }],
    });
    const index = client.initIndex('your_index_name');
  4. Auction Winners: Topsort will automatically include a resolvedBidId attribute in the search results to identify auction winners. You can use this to display sponsored products alongside organic results.

  5. Events: You will need to integrate Topsort’s event tracking (impressions, clicks, purchases) using analytics.js or any of the Topsort SDK’s.

Need help with your Topsort integration?

Talk to us, the integrations engineering team.

Reach us via your dedicated Slack channel or via email at support@topsort.com.

If you're not a customer yet, book a demo with our sales team instead.