Method: projects.locations.userEvents.collect

从浏览器写入单个用户事件。由于浏览器限制向第三方网域发送 POST 请求,因此这里使用 GET 请求。

此方法仅供 Discovery Engine API JavaScript 像素和 Google 跟踪代码管理器使用。用户不应直接调用此方法。

HTTP 请求

GET https://discoveryengine.googleapis.com/v1alpha/{parent=projects/*/locations/*}/userEvents:collect

网址采用 gRPC 转码语法。

路径参数

参数
parent

string

必需。父级资源名称。如果“收集用户事件”操作应用于 DataStore 级别,则格式为:projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}。如果“收集用户事件”操作应用于 Location 级别(例如,事件涉及跨多个 DataStoreDocument),则格式为:projects/{project}/locations/{location}

查询参数

参数
userEvent

string

必需。以网址格式编码的 UserEvent proto,长度上限为 2,000,000 个字符。

uri

string

网址(包含 CGI 参数,但不包含哈希片段),长度上限为 5,000 个字符。该参数通常比引荐来源网址更有用,因为许多浏览器仅针对第三方请求发送域名。

ets

string (int64 format)

事件时间戳(以毫秒为单位)。该参数可以防止浏览器缓存除了时间戳之外完全相同的 GET 请求。该名称已缩写,以减少载荷字节数。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应为通用 HTTP 响应,其格式由方法定义。

授权范围

需要以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/discoveryengine.readwrite
  • https://www.googleapis.com/auth/discoveryengine.assist.readwrite

如需了解详情,请参阅 Authentication Overview