文档
APIAPI 参考

目标

目标的增删改查,以及目标的汇总与时间序列。

POST/api/v1/sites/{siteId}/analytics/goals/summary

获取目标摘要

Returns a goal's conversions and conversion rate by sessions and by visitors.

权限范围analytics:read
附加权限范围
[
  {
    "when": "filter.type=saved",
    "scopes": [
      "analytics:read",
      "analysis:read"
    ]
  }
]
路径参数
siteIdstring必填

ID of the site (see List sites).

≥ 1 chars
请求体application/json
timeRangeobject必填

Reporting window. Use { "kind": "preset", "preset": "last_7_days" } or an absolute range { "kind": "absolute", "from": "…", "to": "…" } with RFC 3339 timestamps. timeZone (IANA name) sets calendar boundaries for presets and buckets.

filterobject | 任意 | null

Optional filter: { "type": "dsl", "expression": "page.path startsWith \"/blog\"" } uses the filter language, { "type": "inline", "expression": … } passes a structured expression, and { "type": "saved", "id": "…" } references a saved filter (requires analysis:read). Team queries accept dsl and inline only. Use null or omit the field for no filter.

scopestring

Which entity a filter condition selects. auto (default) picks the narrowest scope that fits the expression; event, session, and visitor force one.

可选值"auto""event""session""visitor"
goalIdstring必填

ID of a goal (see List goals).

1–512 chars
响应
POST/api/v1/sites/{siteId}/analytics/goals/timeseries

获取目标时间序列

Returns a goal's conversions for each time bucket.

权限范围analytics:read
附加权限范围
[
  {
    "when": "filter.type=saved",
    "scopes": [
      "analytics:read",
      "analysis:read"
    ]
  }
]
路径参数
siteIdstring必填

ID of the site (see List sites).

≥ 1 chars
请求体application/json
timeRangeobject必填

Reporting window. Use { "kind": "preset", "preset": "last_7_days" } or an absolute range { "kind": "absolute", "from": "…", "to": "…" } with RFC 3339 timestamps. timeZone (IANA name) sets calendar boundaries for presets and buckets.

filterobject | 任意 | null

Optional filter: { "type": "dsl", "expression": "page.path startsWith \"/blog\"" } uses the filter language, { "type": "inline", "expression": … } passes a structured expression, and { "type": "saved", "id": "…" } references a saved filter (requires analysis:read). Team queries accept dsl and inline only. Use null or omit the field for no filter.

scopestring

Which entity a filter condition selects. auto (default) picks the narrowest scope that fits the expression; event, session, and visitor force one.

可选值"auto""event""session""visitor"
goalIdstring必填

ID of a goal (see List goals).

1–512 chars
intervalstring必填

Bucket size of the time series: minute, hour, day, week, or month. Keep the number of buckets reasonable for the time range.

可选值"minute""hour""day""week""month"
响应
GET/api/v1/sites/{siteId}/goals

列出目标

Lists the site's goals.

权限范围analysis:read
路径参数
siteIdstring必填

ID of the site (see List sites).

1–256 chars
查询参数
limitinteger

Maximum number of results per page.

默认 501–200
cursorstring | 任意 | null

Opaque pagination cursor from the previous response.

响应
POST/api/v1/sites/{siteId}/goals

创建目标

Creates a goal. A goal converts when an event, page view, session, or visitor matches its filter.

权限范围analysis:write
路径参数
siteIdstring必填

ID of the site (see List sites).

1–256 chars
请求体application/json
filterDslVersion1必填

Filter language version. Always 1.

默认 1
filterDslstring必填

Filter expression that defines a conversion.

1–65536 chars
namestring必填

Display name.

1–200 chars
响应
GET/api/v1/sites/{siteId}/goals/{goalId}

获取目标

Returns one goal.

权限范围analysis:read
路径参数
siteIdstring必填

ID of the site (see List sites).

1–256 chars
goalIdstring必填

ID of the goal.

1–256 chars
响应
PATCH/api/v1/sites/{siteId}/goals/{goalId}

更新目标

Updates a goal. Send only the fields to change.

权限范围analysis:write
路径参数
siteIdstring必填

ID of the site (see List sites).

1–256 chars
goalIdstring必填

ID of the goal.

1–256 chars
请求体application/json
filterDslVersion1
默认 1
filterDslstring
1–65536 chars
namestring
1–200 chars
响应
DELETE/api/v1/sites/{siteId}/goals/{goalId}

删除目标

Deletes a goal. Collected data is not affected.

权限范围analysis:write
路径参数
siteIdstring必填

ID of the site (see List sites).

1–256 chars
goalIdstring必填

ID of the goal.

1–256 chars
响应