启用 Meilisearch Cloud 分析,帮助您了解用户如何在您的应用程序中进行搜索。 本指南将引导您激活分析、更新项目 URL 并配置所有数据点。

要求

您必须拥有 Meilisearch Cloud 帐户才能访问搜索分析。

在项目概览中启用分析

登录您的 Meilisearch Cloud 帐户,导航到项目概览。找到“分析和监控”部分,点击“启用分析和监控”按钮。
The analytics section of the project overview. It shows one button, 'Enable analytics', and a short explanation of the feature.
Meilisearch Cloud 将开始处理您的请求。功能启用后,“分析和监控”部分将更新。
激活分析将自动激活监控

更新应用程序中的 URL

当您启用分析时,Meilisearch Cloud 会更改您项目的 API URL。Meilisearch Cloud 只能跟踪发送到此 URL 的查询指标。 更新您的应用程序,使所有 API 请求都指向新的 URL:
curl \
  -X POST 'https://edge.meilisearch.com/indexes/products/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "green socks" }'
先前的 API URL 将保持功能正常,但针对它的请求不会向分析界面发送任何数据。如果您使用先前的 URL 创建了任何自定义 API 密钥,则需要替换它们。

配置点击率和平均点击位置

为了跟踪点击率和平均点击位置等指标,Meilisearch Cloud 需要知道用户何时点击搜索结果。 每当用户点击搜索结果时,您的应用程序必须向 Meilisearch Cloud 分析路由的 POST 端点发送一个 click 事件:
curl \
  -X POST 'https://edge.meilisearch.com/events' \
  -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
  }'
默认情况下,Meilisearch 会将分析事件与触发它们的用户最近的搜索相关联。 有关更多信息,请查阅分析事件端点参考

配置转化率

要跟踪转化率,首先要确定在您的应用程序中什么算作转化。例如,在网店中,转化可能是用户完成结账流程。 一旦您确定了应用程序中什么算作转化,请将其配置为向 Meilisearch Cloud 分析路由的 POST 端点发送一个 conversion 事件:
curl \
  -X POST 'https://edge.meilisearch.com/events' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer DEFAULT_SEARCH_API_KEY'
  --data-binary '{
    "eventType": "conversion",
    "eventName": "Product Added To Cart",
    "indexUid": "products",
    "objectId": "0",
    "position": 0
  }'
默认情况下,Meilisearch 会将分析事件与触发它们的用户最近的搜索相关联。 无法将多个 conversion 事件与同一个搜索相关联。 有关更多信息,请查阅分析事件端点参考
© . This site is unofficial and not affiliated with Meilisearch.