createAccountTree

建立 Google Analytics (分析) 帳戶,其中包含單一網站資源資料檢視

使用 createAccountTree 建立帳戶時,會沿用 Google Cloud ID 相關聯範本帳戶的設定,且通過核准。這些設定包括:

請注意,這些設定會在帳戶建立時複製。如果範本帳戶設定有所變更,這些變更不會反映在佈建的帳戶中。

要求

HTTP 要求

如要使用 API,請向以下網址傳送 POST 要求:

https://www.googleapis.com/analytics/v3/provisioning/createAccountTree

要求主體

要求主體採用 JSON 格式,內含 Analytics (分析) 帳戶、資源和資料檢視的參數和設定:

{
  "accountName": string,
  "webpropertyName": string,
  "websiteUrl": string,
  "profileName": string,
  "timezone": string,
}
欄位名稱 類型 選用 說明
accountName string 帳戶名稱。
webpropertyName string 與帳戶連結的網站資源名稱。
websiteUrl string 與網站資源相關聯的網址。
profileName string 附加至網站資源的資料檢視名稱。
timezone string 與資料檢視相關聯的時區。時區以 TZ 資料庫中的字串 (例如 America/Los_Angeles) 識別。

此外,此 API 接受所有標準查詢參數

授權

這項要求需要取得下列範圍的授權:

內容範圍
https://www.googleapis.com/auth/analytics.provision

進一步瞭解 Provisioning API 的授權

回應

如果成功,這個方法會傳回 JSON 資源,其中包含新 Analytics (分析) 帳戶的相關資訊:

{
  "kind": "analytics#accountTreeResponse",
  "account": management.accounts Resource,
  "webproperty": management.webproperties Resource,
  "profile": management.profiles Resource,
}
欄位名稱 類型 說明
kind string 此回應的資源類型。
account Account resource 所建立帳戶的詳細資料。
webproperty Web property resource 已建立網站資源的詳細資料。
profile View Resource 已建立檢視表的詳細資料。

另請參閱