> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/activate/event-streaming/destinations/personalization/algolia.md).

# Algolia

Algolia is a search and discovery platform that helps businesses deliver fast, relevant and personalized search experiences on websites and apps. It provides a hosted search API with features like typo tolerance, filters, facets and ranking customization, so teams can optimize user experiences, improve retention and drive growth. This destination sends your Chord events to Algolia as Algolia Insights events.

## Getting started

To use the Algolia destination, you need your Algolia *Application ID* and a *Write API Key*.

**Application ID.** Your Algolia Application ID is on the **Overview** page. It is also next to your API keys in your account settings.

**Write API Key.** Use your account's **Write API Key**, not the Search or Admin key. To find it:

1. Log into your brand's Algolia account and select **Settings** at the bottom left of the dashboard.
2. On the Settings page, select **API Keys** under **Team and Access**.
3. Copy the key titled **Write API Key**.

![Algolia organization settings, with API Keys highlighted under Team and Access](https://2938842758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5Oy2IAsu7IvAGAlWgC36%2Fuploads%2Fgit-blob-77d89914d580b77155f6de1af07ef79637906547%2Falgolia-organization-settings-api-keys.png?alt=media)

## Settings

* **Destination Name** (required): a name to tell this destination apart.
* **Algolia Application ID** (required): your Algolia Application ID.
* **Algolia API Key** (required): your Algolia Write API Key.
* **Consent Requirements** (optional): the consent categories a visitor must accept before Chord sends data to this destination. See [Consent](/activate/event-streaming/consent.md).

## Connect

Add **Algolia** from the destination catalog, using the settings above. See [Connect a destination](/activate/event-streaming/connect-a-destination.md) for the full steps.

## Index, query ID and object IDs

Chord builds the key Algolia Insights attributes from your event properties.

**Index**

Chord reads the [index](https://www.algolia.com/doc/glossary/#index) from event properties, in this order:

* `properties.index` (preferred)
* `properties.search_index` (fallback)

An event with neither is not sent. Chord logs an error that names the missing index.

**Query ID**

[Query IDs](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#what-is-the-query-id) come from `properties.query_id`. They attribute user interactions back to specific search queries. This value should come directly from Algolia's search API response.

Chord sends `Product Clicked`, `Product Added` and `Order Completed` only when the event has a `query_id`. Without one, Chord skips the event, because it did not result from an Algolia search.

**Object IDs**

Chord reads object IDs from the first of these that exists:

* `properties.objectIDs`, when it is a non-empty array.
* `properties.product.product.id`, which becomes a one-item array.
* `properties.product_id`, which becomes a one-item array.
* `properties.products[].product_id`, which becomes an array of all the product IDs.

An event with none of these is not sent. Chord logs an error that names the missing object IDs.

**Positions**

For `Product Clicked`, Chord sends `properties.position`, or the `position` of each item in `properties.products`. The number of positions must equal the number of object IDs, or Chord skips the event without sending it.

**User token**

Chord uses the event's `userId`. If there is none, it uses the anonymous ID.

**Example event**

```json
{
  "type": "track",
  "event": "Product Clicked",
  "userId": "user123",
  "properties": {
    "query_id": "7891011121314151617",
    "index": "products",
    "product_id": "SKU-001",
    "position": 3,
    "search_query": "coffee beans"
  },
  "timestamp": "2025-01-15T10:30:00.000Z"
}
```

Your `product_id` values must exactly match the `objectID` field in your Algolia index for attribution to work.

## Event mapping

Only `track` events are sent. `page` and `identify` events are ignored. Chord sends only the events the [Algolia Insights API](https://www.algolia.com/doc/guides/sending-events/concepts/event-types) uses:

| Chord event                                                                     | Algolia event | Notes                                                   |
| ------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------- |
| [`Order Completed`](/collect-data/tracking-plan/order-completed.md)             | conversion    | Algolia event subtype: purchase. Needs `query_id`: Yes  |
| [`Product Added`](/collect-data/tracking-plan/product-added.md)                 | conversion    | Algolia event subtype: addToCart. Needs `query_id`: Yes |
| [`Product Clicked`](/collect-data/tracking-plan/product-clicked.md)             | click         | Algolia event subtype: -. Needs `query_id`: Yes         |
| [`Product Viewed`](/collect-data/tracking-plan/product-viewed.md)               | view          | Algolia event subtype: -. Needs `query_id`: No          |
| [`Product List Filtered`](/collect-data/tracking-plan/product-list-filtered.md) | view          | Algolia event subtype: -. Needs `query_id`: No          |

Chord does not send any other event. Chord also sends the event's `currency` when it has one.

## Errors and retries

If Algolia rejects an event with status 422, or the event fails Chord's checks above, Chord logs the error and does not retry. Other Algolia errors are retried. See [Errors and retries](/activate/event-streaming/errors-and-retries.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chord.co/activate/event-streaming/destinations/personalization/algolia.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
