文件
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
回應