> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Click and conversion events

> Track user interactions as click and conversion events.

export const AcademyLink = ({href, title}) => {
  return <Card horizontal title="Algolia Academy" href={href} icon="square-play">Learn more about: {title}</Card>;
};

Click and conversion events capture user interactions in your Algolia experience as structured data.

Event data improves your analytics and ranking.
Accurate click and conversion events help Algolia measure performance and
optimize results.

Events are also required for
[NeuralSearch](/doc/guides/ai-relevance/neuralsearch/get-started),
[Recommend](/doc/guides/algolia-recommend/overview),
[Personalization](/doc/guides/personalization/advanced-personalization/what-is-advanced-personalization),
[Dynamic Re-Ranking](/doc/guides/algolia-ai/re-ranking),
[Query Categorization](/doc/guides/algolia-ai/query-categorization), and
[revenue analytics](/doc/guides/search-analytics/concepts/metrics#revenue).
Without click and conversion events, these features can't function.

To see which event methods each feature uses, see
[Event types](/doc/guides/sending-events/concepts/event-types).

<AcademyLink href="https://academy.algolia.com/training/0199aaf1-8024-7ae6-b4e7-07b8c5c098a3/overview" title="Send and format events to power smarter search experiences" />

## Focus on events after search or browse requests

The most important events to consider are those that occur after a search or browse request.
For example:

* **Searches and suggestions**: requests with a search query.

* **Category, navigation, and brand pages**: requests with an empty search query but with applied filters.

To associate an event with a specific request,
events must include a `queryID` parameter.
Without `queryID`, Algolia can't link the event to the originating search or browse request.
For some conversion events, Algolia can infer the `queryID` from an earlier click event.

For implementation details, see
[Keep track of query IDs](/doc/guides/sending-events/guides/queryid).

Events that include a `queryID` help Algolia determine if results were useful to users.

### Basic events flow

<Steps>
  <Step title="User searches or visits a category page (powered by Algolia)">
    ```mermaid theme={"system"}
    flowchart LR
        U((👤 User)) -->|Search or browse request| A[Your frontend]
    ```
  </Step>

  <Step title="Your frontend sends a request to the Search API">
    ```mermaid theme={"system"}
    flowchart LR
        A[Your frontend] -->|search request with or without query| S[(Search API)]
    ```

    The request includes these parameters:

    * `userToken`:
      to identify users (pseudonymously)
    * `clickAnalytics: true`:
      to return `queryID`
  </Step>

  <Step title="Search API returns results">
    ```mermaid theme={"system"}
    flowchart LR
        S[(Search API)] -->|search results, including query ID| A[Your frontend]
    ```

    The response includes `queryID`, object IDs of the matching records, and positions.
  </Step>

  <Step title="User clicks an item, adds it to the cart, or converts in another way">
    ```mermaid theme={"system"}
    flowchart LR
        U((👤 User)) -->|Click or conversion| A[Your frontend]
    ```
  </Step>

  <Step title="Your frontend sends an event to the Insights API">
    ```mermaid theme={"system"}
    flowchart LR
        A[Your frontend] -->|event| I[(Insights API)]
    ```

    Include at least these properties in search-related events:

    * `userToken`
    * `queryID`
    * `objectIDs`

    For some conversion events, Algolia can infer the `queryID` automatically.
    For details, see [Keep track of query IDs](/doc/guides/sending-events/guides/queryid).

    Some [event types](/doc/guides/sending-events/concepts/event-types) need more
    properties.
    For more details, see also the
    [Insights API reference](/doc/rest-api/insights/push-events).
  </Step>
</Steps>

Events that don't follow a search or browse request still matter.
Examples include clicks on product recommendations in an email.
These signals help [Recommend](/doc/guides/algolia-recommend/overview) and
[Personalization](/doc/guides/personalization/advanced-personalization/what-is-advanced-personalization).

## Use one stable user identity

The `userToken` identifies a visitor or signed-in user.
Keep it stable during a session.
If your privacy model allows it, keep it stable across sessions too.
A consistent user identity is essential for analytics and Personalization.

You must send the **same** `userToken` with your search requests and events.
For identity strategies and persistence options, see
[User token](/doc/guides/sending-events/concepts/usertoken).

Before you send `userToken`, decide how Algolia should treat identity across
sessions, devices, and login states:

* **Pre- and post-login behavior**:
  use the same `userToken` before and after login if those events belong to one
  user.

* **Cross-device identity**:
  use the same `userToken` across devices if the same user signs in on each one.
  This often uses a persistent ID from your customer data platform (CDP).

* **Per-session identity**:
  generate a new anonymous `userToken` for each session if each session should
  count as a new user.

## Before you send events

* Understand how to maintain a consistent `userToken`.
* Understand how the `queryID` flows from a search request to events.
* Identify every interface where users interact with Algolia results or recommendations.

## Choose an implementation path

Now choose how you want to send events and validate them.

* [Get started with click and conversion events](/doc/guides/sending-events/getting-started)
* [Plan your implementation](/doc/guides/sending-events/guides/plan)
* [Validate your events](/doc/guides/sending-events/guides/validate)
