Create a Google Analytics account, which includes a single web property and view.
When an account is created with createAccountTree
, it inherits a number a settings from the template account associated with your Google Cloud ID when approved. These settings include:
- All data sharing settings.
- Acceptance of the Data Processing Terms and Measurement Controller-Controller Data Protection Agreement.
- The organization associated with the template account, if any.
- The language and country code selected while accepting the Terms of Service.
Note that these setting are copied at account creation time. If the template account settings are changed, these changes will not be reflected in the provisioned account.
Request
HTTP Request
To use the API, make a POST
request to this URL:
https://www.googleapis.com/analytics/v3/provisioning/createAccountTree
Request Body
The request body is JSON formatted and contains parameters and configuration for the Analytics account, property, and view:
{ "accountName": string, "webpropertyName": string, "websiteUrl": string, "profileName": string, "timezone": string, }
Field Name | Type | Optional | Description |
---|---|---|---|
accountName |
string |
The name of the account. | |
webpropertyName |
string |
The name of the web property attached to the Account. | |
websiteUrl |
string |
The web URL associated with the web property. | |
profileName |
string |
The name of the view attached to the web property. | |
timezone |
string |
The timezone associated with the view. Time zones are identified by strings from the TZ database (e.g. America/Los_Angeles ). |
Additionally, the API accepts all Standard Query Parameters
Authorization
This request requires authorization with the following scope(s):
Scope |
---|
https://www.googleapis.com/auth/analytics.provision |
Read more about authorization for the Provisioning API
Response
If successful, this method returns a JSON resource containing information about the new Analytics account:
{ "kind": "analytics#accountTreeResponse", "account": management.accounts Resource, "webproperty": management.webproperties Resource, "profile": management.profiles Resource, }
Field Name | Type | Description |
---|---|---|
kind |
string |
Resource type for this response. |
account |
Account resource |
Details of the created account. |
webproperty |
Web property resource |
Details of the created web property. |
profile |
View Resource |
Details of the created view. |
See also
createAccountTicket
- Once you've created an analytics account, you can configure it with the Management API.
- Google Analytics data security and privacy principles