Google Analytics API
  1. management
Google Analytics API
  • data
    • /data/ga
    • /data/mcf
    • /data/realtime
  • management
    • /management/accountSummaries
      GET
    • /management/accounts
      GET
    • /management/accounts/{accountId}/entityUserLinks
      GET
    • /management/accounts/{accountId}/entityUserLinks
      POST
    • /management/accounts/{accountId}/entityUserLinks/{linkId}
      DELETE
    • /management/accounts/{accountId}/entityUserLinks/{linkId}
      PUT
    • /management/accounts/{accountId}/filters
      GET
    • /management/accounts/{accountId}/filters
      POST
    • /management/accounts/{accountId}/filters/{filterId}
      DELETE
    • /management/accounts/{accountId}/filters/{filterId}
      GET
    • /management/accounts/{accountId}/filters/{filterId}
      PATCH
    • /management/accounts/{accountId}/filters/{filterId}
      PUT
    • /management/accounts/{accountId}/webproperties
      GET
    • /management/accounts/{accountId}/webproperties
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}
      PATCH
    • /management/accounts/{accountId}/webproperties/{webPropertyId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/deleteUploadData
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads/{uploadId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions/{customDimensionId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions/{customDimensionId}
      PATCH
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions/{customDimensionId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics/{customMetricId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics/{customMetricId}
      PATCH
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics/{customMetricId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks/{webPropertyAdWordsLinkId}
      DELETE
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks/{webPropertyAdWordsLinkId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks/{webPropertyAdWordsLinkId}
      PATCH
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks/{webPropertyAdWordsLinkId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks/{linkId}
      DELETE
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks/{linkId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}
      DELETE
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}
      PATCH
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks/{linkId}
      DELETE
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks/{linkId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}
      DELETE
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}
      PATCH
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals/{goalId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals/{goalId}
      PATCH
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals/{goalId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks/{linkId}
      DELETE
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks/{linkId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks/{linkId}
      PATCH
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks/{linkId}
      PUT
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/unsampledReports
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/unsampledReports
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/unsampledReports/{unsampledReportId}
      DELETE
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/unsampledReports/{unsampledReportId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences
      POST
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}
      DELETE
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}
      GET
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}
      PATCH
    • /management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}
      PUT
    • /management/clientId:hashClientId
      POST
    • /management/segments
      GET
  • metadata
    • /metadata/{reportType}/columns
  • provisioning
    • /provisioning/createAccountTicket
    • /provisioning/createAccountTree
  • userDeletion
    • /userDeletion/userDeletionRequests:upsert
  1. management

/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}

PUT
/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}
management
Update an existing experiment.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request PUT 'https://analytics.googleapis.com/analytics/v3/management/accounts//webproperties//profiles//experiments/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "accountId": "string",
    "created": "2019-08-24T14:15:22Z",
    "description": "string",
    "editableInGaUi": true,
    "endTime": "2019-08-24T14:15:22Z",
    "equalWeighting": true,
    "id": "string",
    "internalWebPropertyId": "string",
    "kind": "analytics#experiment",
    "minimumExperimentLengthInDays": 0,
    "name": "string",
    "objectiveMetric": "string",
    "optimizationType": "string",
    "parentLink": {
        "href": "string",
        "type": "analytics#profile"
    },
    "profileId": "string",
    "reasonExperimentEnded": "string",
    "rewriteVariationUrlsAsOriginal": true,
    "selfLink": "string",
    "servingFramework": "string",
    "snippet": "string",
    "startTime": "2019-08-24T14:15:22Z",
    "status": "string",
    "trafficCoverage": 0,
    "updated": "2019-08-24T14:15:22Z",
    "variations": [
        {
            "name": "string",
            "status": "string",
            "url": "string",
            "weight": 0,
            "won": true
        }
    ],
    "webPropertyId": "string",
    "winnerConfidenceLevel": 0,
    "winnerFound": true
}'
Response Response Example
{
  "accountId": "string",
  "created": "2019-08-24T14:15:22Z",
  "description": "string",
  "editableInGaUi": true,
  "endTime": "2019-08-24T14:15:22Z",
  "equalWeighting": true,
  "id": "string",
  "internalWebPropertyId": "string",
  "kind": "analytics#experiment",
  "minimumExperimentLengthInDays": 0,
  "name": "string",
  "objectiveMetric": "string",
  "optimizationType": "string",
  "parentLink": {
    "href": "string",
    "type": "analytics#profile"
  },
  "profileId": "string",
  "reasonExperimentEnded": "string",
  "rewriteVariationUrlsAsOriginal": true,
  "selfLink": "string",
  "servingFramework": "string",
  "snippet": "string",
  "startTime": "2019-08-24T14:15:22Z",
  "status": "string",
  "trafficCoverage": 0,
  "updated": "2019-08-24T14:15:22Z",
  "variations": [
    {
      "name": "string",
      "status": "string",
      "url": "string",
      "weight": 0,
      "won": true
    }
  ],
  "webPropertyId": "string",
  "winnerConfidenceLevel": 0,
  "winnerFound": true
}

Request

Path Params
accountId
string 
required
Account ID of the experiment to update.
webPropertyId
string 
required
Web property ID of the experiment to update.
profileId
string 
required
View (Profile) ID of the experiment to update.
experimentId
string 
required
Experiment ID of the experiment to update.
Body Params application/json
JSON template for Analytics experiment resource.
accountId
string 
optional
Account ID to which this experiment belongs. This field is read-only.
created
string <date-time>
optional
Time the experiment was created. This field is read-only.
description
string 
optional
Notes about this experiment.
editableInGaUi
boolean 
optional
If true, the end user will be able to edit the experiment via the Google Analytics user interface.
endTime
string <date-time>
optional
The ending time of the experiment (the time the status changed from RUNNING to ENDED). This field is present only if the experiment has ended. This field is read-only.
equalWeighting
boolean 
optional
Boolean specifying whether to distribute traffic evenly across all variations. If the value is False, content experiments follows the default behavior of adjusting traffic dynamically based on variation performance. Optional -- defaults to False. This field may not be changed for an experiment whose status is ENDED.
id
string 
optional
Experiment ID. Required for patch and update. Disallowed for create.
internalWebPropertyId
string 
optional
Internal ID for the web property to which this experiment belongs. This field is read-only.
kind
string 
optional
Resource type for an Analytics experiment. This field is read-only.
Default:
analytics#experiment
minimumExperimentLengthInDays
integer <int32>
optional
An integer number in [3, 90]. Specifies the minimum length of the experiment. Can be changed for a running experiment. This field may not be changed for an experiments whose status is ENDED.
name
string 
optional
Experiment name. This field may not be changed for an experiment whose status is ENDED. This field is required when creating an experiment.
objectiveMetric
string 
optional
The metric that the experiment is optimizing. Valid values: "ga:goal(n)Completions", "ga:adsenseAdsClicks", "ga:adsenseAdsViewed", "ga:adsenseRevenue", "ga:bounces", "ga:pageviews", "ga:sessionDuration", "ga:transactions", "ga:transactionRevenue". This field is required if status is "RUNNING" and servingFramework is one of "REDIRECT" or "API".
optimizationType
string 
optional
Whether the objectiveMetric should be minimized or maximized. Possible values: "MAXIMUM", "MINIMUM". Optional--defaults to "MAXIMUM". Cannot be specified without objectiveMetric. Cannot be modified when status is "RUNNING" or "ENDED".
parentLink
object 
optional
Parent link for an experiment. Points to the view (profile) to which this experiment belongs.
href
string 
optional
Link to the view (profile) to which this experiment belongs. This field is read-only.
type
string 
optional
Value is "analytics#profile". This field is read-only.
Default:
analytics#profile
profileId
string 
optional
View (Profile) ID to which this experiment belongs. This field is read-only.
reasonExperimentEnded
string 
optional
Why the experiment ended. Possible values: "STOPPED_BY_USER", "WINNER_FOUND", "EXPERIMENT_EXPIRED", "ENDED_WITH_NO_WINNER", "GOAL_OBJECTIVE_CHANGED". "ENDED_WITH_NO_WINNER" means that the experiment didn't expire but no winner was projected to be found. If the experiment status is changed via the API to ENDED this field is set to STOPPED_BY_USER. This field is read-only.
rewriteVariationUrlsAsOriginal
boolean 
optional
Boolean specifying whether variations URLS are rewritten to match those of the original. This field may not be changed for an experiments whose status is ENDED.
selfLink
string 
optional
Link for this experiment. This field is read-only.
servingFramework
string 
optional
The framework used to serve the experiment variations and evaluate the results. One of:
REDIRECT: Google Analytics redirects traffic to different variation pages, reports the chosen variation and evaluates the results.
API: Google Analytics chooses and reports the variation to serve and evaluates the results; the caller is responsible for serving the selected variation.
EXTERNAL: The variations will be served externally and the chosen variation reported to Google Analytics. The caller is responsible for serving the selected variation and evaluating the results.
snippet
string 
optional
The snippet of code to include on the control page(s). This field is read-only.
startTime
string <date-time>
optional
The starting time of the experiment (the time the status changed from READY_TO_RUN to RUNNING). This field is present only if the experiment has started. This field is read-only.
status
string 
optional
Experiment status. Possible values: "DRAFT", "READY_TO_RUN", "RUNNING", "ENDED". Experiments can be created in the "DRAFT", "READY_TO_RUN" or "RUNNING" state. This field is required when creating an experiment.
trafficCoverage
number <double>
optional
A floating-point number in (0, 1]. Specifies the fraction of the traffic that participates in the experiment. Can be changed for a running experiment. This field may not be changed for an experiments whose status is ENDED.
updated
string <date-time>
optional
Time the experiment was last modified. This field is read-only.
variations
array [object {5}] 
optional
Array of variations. The first variation in the array is the original. The number of variations may not change once an experiment is in the RUNNING state. At least two variations are required before status can be set to RUNNING.
name
string 
optional
The name of the variation. This field is required when creating an experiment. This field may not be changed for an experiment whose status is ENDED.
status
string 
optional
Status of the variation. Possible values: "ACTIVE", "INACTIVE". INACTIVE variations are not served. This field may not be changed for an experiment whose status is ENDED.
url
string 
optional
The URL of the variation. This field may not be changed for an experiment whose status is RUNNING or ENDED.
weight
number <double>
optional
Weight that this variation should receive. Only present if the experiment is running. This field is read-only.
won
boolean 
optional
True if the experiment has ended and this variation performed (statistically) significantly better than the original. This field is read-only.
webPropertyId
string 
optional
Web property ID to which this experiment belongs. The web property ID is of the form UA-XXXXX-YY. This field is read-only.
winnerConfidenceLevel
number <double>
optional
A floating-point number in (0, 1). Specifies the necessary confidence level to choose a winner. This field may not be changed for an experiments whose status is ENDED.
winnerFound
boolean 
optional
Boolean specifying whether a winner has been found for this experiment. This field is read-only.
Examples

Responses

🟢200Successful response
application/json
Body
JSON template for Analytics experiment resource.
accountId
string 
optional
Account ID to which this experiment belongs. This field is read-only.
created
string <date-time>
optional
Time the experiment was created. This field is read-only.
description
string 
optional
Notes about this experiment.
editableInGaUi
boolean 
optional
If true, the end user will be able to edit the experiment via the Google Analytics user interface.
endTime
string <date-time>
optional
The ending time of the experiment (the time the status changed from RUNNING to ENDED). This field is present only if the experiment has ended. This field is read-only.
equalWeighting
boolean 
optional
Boolean specifying whether to distribute traffic evenly across all variations. If the value is False, content experiments follows the default behavior of adjusting traffic dynamically based on variation performance. Optional -- defaults to False. This field may not be changed for an experiment whose status is ENDED.
id
string 
optional
Experiment ID. Required for patch and update. Disallowed for create.
internalWebPropertyId
string 
optional
Internal ID for the web property to which this experiment belongs. This field is read-only.
kind
string 
optional
Resource type for an Analytics experiment. This field is read-only.
Default:
analytics#experiment
minimumExperimentLengthInDays
integer <int32>
optional
An integer number in [3, 90]. Specifies the minimum length of the experiment. Can be changed for a running experiment. This field may not be changed for an experiments whose status is ENDED.
name
string 
optional
Experiment name. This field may not be changed for an experiment whose status is ENDED. This field is required when creating an experiment.
objectiveMetric
string 
optional
The metric that the experiment is optimizing. Valid values: "ga:goal(n)Completions", "ga:adsenseAdsClicks", "ga:adsenseAdsViewed", "ga:adsenseRevenue", "ga:bounces", "ga:pageviews", "ga:sessionDuration", "ga:transactions", "ga:transactionRevenue". This field is required if status is "RUNNING" and servingFramework is one of "REDIRECT" or "API".
optimizationType
string 
optional
Whether the objectiveMetric should be minimized or maximized. Possible values: "MAXIMUM", "MINIMUM". Optional--defaults to "MAXIMUM". Cannot be specified without objectiveMetric. Cannot be modified when status is "RUNNING" or "ENDED".
parentLink
object 
optional
Parent link for an experiment. Points to the view (profile) to which this experiment belongs.
href
string 
optional
Link to the view (profile) to which this experiment belongs. This field is read-only.
type
string 
optional
Value is "analytics#profile". This field is read-only.
Default:
analytics#profile
profileId
string 
optional
View (Profile) ID to which this experiment belongs. This field is read-only.
reasonExperimentEnded
string 
optional
Why the experiment ended. Possible values: "STOPPED_BY_USER", "WINNER_FOUND", "EXPERIMENT_EXPIRED", "ENDED_WITH_NO_WINNER", "GOAL_OBJECTIVE_CHANGED". "ENDED_WITH_NO_WINNER" means that the experiment didn't expire but no winner was projected to be found. If the experiment status is changed via the API to ENDED this field is set to STOPPED_BY_USER. This field is read-only.
rewriteVariationUrlsAsOriginal
boolean 
optional
Boolean specifying whether variations URLS are rewritten to match those of the original. This field may not be changed for an experiments whose status is ENDED.
selfLink
string 
optional
Link for this experiment. This field is read-only.
servingFramework
string 
optional
The framework used to serve the experiment variations and evaluate the results. One of:
REDIRECT: Google Analytics redirects traffic to different variation pages, reports the chosen variation and evaluates the results.
API: Google Analytics chooses and reports the variation to serve and evaluates the results; the caller is responsible for serving the selected variation.
EXTERNAL: The variations will be served externally and the chosen variation reported to Google Analytics. The caller is responsible for serving the selected variation and evaluating the results.
snippet
string 
optional
The snippet of code to include on the control page(s). This field is read-only.
startTime
string <date-time>
optional
The starting time of the experiment (the time the status changed from READY_TO_RUN to RUNNING). This field is present only if the experiment has started. This field is read-only.
status
string 
optional
Experiment status. Possible values: "DRAFT", "READY_TO_RUN", "RUNNING", "ENDED". Experiments can be created in the "DRAFT", "READY_TO_RUN" or "RUNNING" state. This field is required when creating an experiment.
trafficCoverage
number <double>
optional
A floating-point number in (0, 1]. Specifies the fraction of the traffic that participates in the experiment. Can be changed for a running experiment. This field may not be changed for an experiments whose status is ENDED.
updated
string <date-time>
optional
Time the experiment was last modified. This field is read-only.
variations
array [object {5}] 
optional
Array of variations. The first variation in the array is the original. The number of variations may not change once an experiment is in the RUNNING state. At least two variations are required before status can be set to RUNNING.
name
string 
optional
The name of the variation. This field is required when creating an experiment. This field may not be changed for an experiment whose status is ENDED.
status
string 
optional
Status of the variation. Possible values: "ACTIVE", "INACTIVE". INACTIVE variations are not served. This field may not be changed for an experiment whose status is ENDED.
url
string 
optional
The URL of the variation. This field may not be changed for an experiment whose status is RUNNING or ENDED.
weight
number <double>
optional
Weight that this variation should receive. Only present if the experiment is running. This field is read-only.
won
boolean 
optional
True if the experiment has ended and this variation performed (statistically) significantly better than the original. This field is read-only.
webPropertyId
string 
optional
Web property ID to which this experiment belongs. The web property ID is of the form UA-XXXXX-YY. This field is read-only.
winnerConfidenceLevel
number <double>
optional
A floating-point number in (0, 1). Specifies the necessary confidence level to choose a winner. This field may not be changed for an experiments whose status is ENDED.
winnerFound
boolean 
optional
Boolean specifying whether a winner has been found for this experiment. This field is read-only.
Modified at 2023-08-15 05:39:07
Previous
/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}
Next
/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals
Built with