Go to homev1.5 Docs

    Analytics

    Enable Meilisearch Cloud analytics to gain insight on what your users are searching for, how often they find it, and whether they take any actions after clicking on a search result.

    Requirements

    You must have a Meilisearch Cloud account to access search analytics.

    Activating analytics

    Enable analytics in the project overview

    Log into your Meilisearch Cloud account and navigate to your project's overview. Find the "Analytics" section and click on the "Enable analytics" button:

    The analytics section of the project overview. It shows one button, "Enable analytics", and a short explanation of the feature.

    Meilisearch Cloud will begin processing your request. The "Analytics" section will update when the feature is enabled.

    Update URLs in your application

    When you enable analytics, Meilisearch Cloud changes your project's API URL. Meilisearch Cloud is only able to track metrics for queries sent to this URL.

    Update your application so all API requests point to the new URL:

    curl \
      -X POST 'http://edge.meilisearch.com/indexes/products/search' \
      -H 'Content-Type: application/json' \
      --data-binary '{ "q": "green socks" }'
    

    The previous API URL will remain functional, but requests targeting it will not send any data to the analytics interface.

    Configuring click-through rate and average click position

    To track metrics like click-through rate and average click position, Meilisearch Cloud needs to know when users click on search results.

    Every time a user clicks on a search result, your application must send a click event to the POST endpoint of Meilisearch Cloud analytics route:

    curl \
      -X POST 'http://edge.meilisearch.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY'
      --data-binary '{ 
        "eventType": "click",
        "eventName": "Search Result Clicked",
        "indexUid": "products",
        "objectID": "0",
        "position": 0
      }'
    

    The click event object

    The click event must deliver an object with the following fields:

    {
      "eventType": "click",
      "eventName": "Search Result Clicked",
      "indexUid": "products",
      "objectID": "0",
      "position": 0
    }
    

    Configuring conversion rate

    To track conversion rate, first identify what should count as a conversion for your application. For example, in a web shop, a conversion might be a user finalizing the checkout process.

    Once you have established what counts as a conversion in your application, configure it to send a conversion event to the POST endpoint of Meilisearch Cloud analytics route:

    curl \
      -X POST 'http://edge.meilisearch.com' \
      -H 'Content-Type: application/json' \
      -H 'Authorization: Bearer Meilisearch_API_Key'
      --data-binary '{ 
        "eventType": "conversion",
        "eventName": "Product Added To Cart",
        "indexUid": "products",
        "objectID": "0",
        "position": 0
      }'
    

    It is not possible to associate multiple conversion events with the same search.

    The conversion event object

    The conversion event must deliver an object with the following fields:

    {
      "eventType": "conversion",
      "eventName": "Product Added To Cart",
      "indexUid": "products",
      "objectID": "0",
      "position": 0
    }
    

    Deactivating analytics

    Disable analytics in the project overview

    Log into your Meilisearch Cloud account and navigate to your project's overview. Find the "Analytics" section and press the "Disable analytics" button:

    The analytics section of the project overview. It shows one button, "Disable analytics", and a short explanation of the feature.

    Update URLs in your application

    Disabling analytics changes your API URL. Update your application so all API requests point to the correct URL:

    curl \
      -X POST 'http://PROJECT_URL/indexes/products/search' \
      -H 'Content-Type: application/json' \
      --data-binary '{ "q": "green socks" }'
    

    The previous API URL will remain functional, but Meilisearch recommends not using it after disabling analytics in your project.

    Update conversion and click events

    Update your application so it is no longer sending conversion and click events to Meilisearch Cloud.