My favorites | English | Sign in

Google Analytics (Labs)

Website Optimizer API - Common Tasks

This document describes how to perform basic Website Optimizer tasks using the API. These examples use the command line tool cURL to access the API, but the basic approach is the same regardless of the tool or client library you are using to access the API.

Rather than repeat the authorization and version header info (which are the same for each example), we include a placeholder <BASE-OPTIONS> tag that you should replace with the following options:

--silent \
--header "GData-Version: 2.0" \
--header "Authorization: GoogleLogin auth=EUBBIac....Q53aQVC2132JKOuGh" \

Replace the Authorization token with the one that you received from ClientLogin (see the Quick Start section).

Google Data-Version: 2.0 is required if you wish to update, insert, or delete experiments. If you omit this, you will get version 1.0 of the API which does not have the gd:etags required to send update requests

General Experiment Tasks
Start an experiment
Update an experiment
Get detailed info about an experiment
Get list of experiments
View all combinations in an experiment
View a single combination in an experiment
Copy an experiment
Launch a follow-up experiment
Delete an experiment

A/B Experiments
Create a new A/B experiment
Add a new page variation to an A/B experiment
View a single page variation in an A/B experiment
View all page variations in an A/B experiment
Update a page variation in an A/B experiment
Delete a page variation from an A/B experiment
Multivariate Experiments
Create a new multivariate experiment

Add a new section to a multivariate experiment
View a single section in a multivariate experiment
View all sections in a multivariate experiment
Update a section in a multivariate experiment
Delete a section from a multivariate experiment

Add a new variation to a section in a multivariate experiment
View a single variation within a section of a multivariate experiment
View all variations within a section of a multivariate experiment
Update a variation in a section in a multivariate experiment
Delete a variation from a section in a multivariate experiment

General Experiment Tasks

Start an experiment

First, request the experiment that you wish to start:

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}"

Save the returned XML description (into "experiment.xml"). It should look something like:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'
       gd:etag='W/"A0UGRn47eCp7ImA9WxNSGUw."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/619581</id>
  <updated>2009-09-02T12:20:27.000-07:00</updated>
  <app:edited>2009-09-02T12:20:27.000-07:00</app:edited>
  <title>New experiment</title>
  <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
  <link rel='self' type='application/atom+xml' href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/619581' />
  <gwo:controlScript>...</gwo:controlScript>
  <gwo:conversionScript>...</gwo:conversionScript>
  <gwo:experimentType>Multivariate</gwo:experimentType>
  <gwo:numCombinations>1</gwo:numCombinations>
  <gwo:numSections>0</gwo:numSections>
  <gwo:status>New</gwo:status>
  <gwo:trackingScript>...</gwo:trackingScript>
</entry>

Replace the current gwo:status with the following:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>
...
<gwo:status>Running</gwo:status>
...
</entry>

The remaining fields can be deleted since they will be ignored. After you've made this change, update the experiment using:

curl <BASE-OPTIONS> --request PUT --data "@experiment.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}"

If successful, the update returns the experiment. You can verify that the experiment was started by reading the gwo:status in the returned experiment. This approach can be used to pause experiments as well by setting the gwo:status to "Paused".

Back

Update an experiment

First, request the experiment that you wish to update:

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}"

Save the returned XML description (into "experiment.xml") and make the desired edits. Each entry has a special gd:etag which is used to keep track of the current version. After you've made the changes, update the experiment using:

curl <BASE-OPTIONS> --request PUT --data "@experiment.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}"

As long as the entry has not been updated on the server since your initial request (i.e., as long as the gd:etag matches), the update should succeed. If the experiment has been updated then the update request will fail.

Get detailed info about an experiment

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}"

where {experimentId} is replaced with the experiment ID of the experiment.

A multivariate experiment will look like:

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/&quot;DUAARn47eCp7ImA9WxJWFkU.&quot;'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172</id>
  <updated>2009-06-22T09:22:27.000-07:00</updated>
  <app:edited>2009-06-22T09:22:27.000-07:00</app:edited>
  <title>Sample multivariate experiment</title>
  <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer'/>
  <link rel='self' type='application/atom+xml' href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172'/>
  <gwo:analyticsAccountId>1234</gwo:analyticsAccountId>
  <gwo:controlScript>...</gwo:controlScript>
  <gwo:conversionScript>...</gwo:conversionScript>
  <gwo:experimentId>48172</gwo:experimentId>
  <gwo:experimentType>Multivariate</gwo:experimentType>
  <gwo:numCombinations>12</gwo:numCombinations>
  <gwo:numSections>3</gwo:numSections>
  <gwo:status>Running</gwo:status>
  <gwo:trackingScript>...</gwo:trackingScript>
</entry>

while an A/B experiment will look like:

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/&quot;D0cESH47eCp7ImA9WxVQEE0.&quot;'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738</id>
  <updated>2009-01-26T13:23:29.000-08:00</updated>
  <app:edited>2009-01-26T13:23:29.000-08:00</app:edited>
  <title>Sample A/B experiment</title>
  <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer'/>
  <link rel='self' type='application/atom+xml' href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738'/>
  <gwo:analyticsAccountId>1234</gwo:analyticsAccountId>
  <gwo:controlScript>...</gwo:controlScript>
  <gwo:conversionScript>...</gwo:conversionScript>
  <gwo:experimentId>364738</gwo:experimentId>
  <gwo:experimentType>AB</gwo:experimentType>
  <gwo:numAbPageVariations>2</gwo:numAbPageVariations>
  <gwo:numCombinations>2</gwo:numCombinations>
  <gwo:status>New</gwo:status>
  <gwo:trackingScript>...</gwo:trackingScript>
</entry>

Note that multivariate experiments have sections (gwo:numSections) whereas A/B experiments have page variations (gwo:numAbPageVariations).

Back

Get list of experiments

Use the following to request a list of experiments for a user:

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments"

This will return something like the following:

<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
    xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/"CEQHR347eCp7ImA9WxNREEs."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/</id>
  <updated>2009-09-04T04:05:36.000-07:00</updated>
  <title>Experiment list for myemail@gmail.com</title>
  <link rel='self' type='application/atom+xml'
      href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/' />
  <author>
    <name>Google Analytics / Website Optimizer</name>
  </author>
  <generator version='1.0'>Google Analytics</generator>
  <openSearch:totalResults>2</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <openSearch:itemsPerPage>2</openSearch:itemsPerPage>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <app:edited>2009-06-22T09:22:27.000-07:00</app:edited>
    <title>Sample multivariate experiment</title>
    <link rel='alternate' type='text/html'
        href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172' />
    <gwo:analyticsAccountId>1234</gwo:analyticsAccountId>
    <gwo:experimentId>48172</gwo:experimentId>
    <gwo:experimentType>Multivariate</gwo:experimentType>
    <gwo:numCombinations>12</gwo:numCombinations>
    <gwo:numSections>3</gwo:numSections>
    <gwo:status>Running</gwo:status>
  </entry>
  <entry gd:etag='W/"D0cESH47eCp7ImA9WxVQEE0."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738</id>
    <updated>2009-01-26T13:23:29.000-08:00</updated>
    <app:edited>2009-01-26T13:23:29.000-08:00</app:edited>
    <title>Sample A/B experiment</title>
    <link rel='alternate' type='text/html'
        href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738' />
    <gwo:analyticsAccountId>1234</gwo:analyticsAccountId>
    <gwo:experimentId>364738</gwo:experimentId>
    <gwo:experimentType>AB</gwo:experimentType>
    <gwo:numAbPageVariations>2</gwo:numAbPageVariations>
    <gwo:numCombinations>2</gwo:numCombinations>
    <gwo:status>New</gwo:status>
  </entry>
</feed>

Back

View all combinations in an experiment

Use the following to request all combinations for an experiment:

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/combinations"

This returns (for a multivariate experiment with 3 sections and a total of 12 combinations):

<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
    xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
    xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/</id>
  <updated>2009-06-22T09:22:27.000-07:00</updated>
  <title>Combination list for experiment #48172</title>
  <link rel='self' type='application/atom+xml'
      href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/' />
  <author>
    <name>Google Analytics / Website Optimizer</name>
  </author>
  <generator version='1.0'>Google Analytics</generator>
  <openSearch:totalResults>12</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <openSearch:itemsPerPage>12</openSearch:itemsPerPage>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/0</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <title>Combination #0</title>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/0' />
    <gwo:comboActive>true</gwo:comboActive>
    <gwo:comboId>0</gwo:comboId>
    <gwo:comboString>0-0-0</gwo:comboString>
  </entry>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/1</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <title>Combination #1</title>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/1' />
    <gwo:comboActive>true</gwo:comboActive>
    <gwo:comboId>1</gwo:comboId>
    <gwo:comboString>1-0-0</gwo:comboString>
  </entry>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/2</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <title>Combination #2</title>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/2' />
    <gwo:comboActive>true</gwo:comboActive>
    <gwo:comboId>2</gwo:comboId>
    <gwo:comboString>0-1-0</gwo:comboString>
  </entry>
  ....
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/10</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <title>Combination #10</title>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/10' />
    <gwo:comboActive>true</gwo:comboActive>
    <gwo:comboId>10</gwo:comboId>
    <gwo:comboString>0-2-1</gwo:comboString>
  </entry>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/11</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <title>Combination #11</title>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/11' />
    <gwo:comboActive>true</gwo:comboActive>
    <gwo:comboId>11</gwo:comboId>
    <gwo:comboString>1-2-1</gwo:comboString>
  </entry>
</feed>

Back

View a single combination in an experiment

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/combinations/{combinationId}"

This returns (in this example: experimentId=48172, combinationId=4):

<?xml version='1.0' encoding='utf-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/4</id>
  <updated>2009-06-22T09:22:27.000-07:00</updated>
  <title>Combination #4</title>
  <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
  <link rel='self' type='application/atom+xml'
      href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/combinations/4' />
  <gwo:comboActive>true</gwo:comboActive>
  <gwo:comboId>4</gwo:comboId>
  <gwo:comboString>0-2-0</gwo:comboString>
</entry>

A combination description can be used in place of the combinationId if desired. A combination description is a string that contains a list of variation IDs - one for each section. For example, an experiment with 4 sections might request a combination using 1-2-0-1 to select the combination corresponding to variation #1 in section #0, variation #2 in section #1, variation #0 in section #2 and variation #1 in section #3.

Back

Copy an experiment

To create a copy of an experiment, create a text file named copyexperiment.xml that describes your experiment. Set the gwo:analyticsAccountId to your Analytics account ID (the XXXX number in the UA-XXXX-Y string from your tracking code) and set the gwo:sourceExperimentId to the ID of the experiment you want to copy.

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>
<title>My experiment copy</title>
<gwo:analyticsAccountId>XXXX</gwo:analyticsAccountId>
<gwo:sourceExperimentId>YYYY</gwo:sourceExperimentId>
</entry>

Then create the experiment copy by sending a POST with this file to the experiments feed:

curl <BASE-OPTIONS> --request POST --data "@copyexperiment.xml" --header "Content-Type:
    application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments" 

Launch a follow-up experiment

To create/launch a follow-up experiment, create a text file named followupexperiment.xml that describes your experiment. Set the gwo:analyticsAccountId to your Analytics account ID (the XXXX number in the UA-XXXX-Y string from your tracking code) and set the gwo:sourceExperimentId to the ID of the experiment you want to follow-up.

So far, these are exactly the same steps you follow if you want to make an experiment copy. A follow-up experiment has one additional piece of required information: the verification combination ID that is run against the original. This is specified by setting gwo:verificationCombo to the desired combination ID.

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>
<title>My experiment copy</title>
<gwo:analyticsAccountId>XXXX</gwo:analyticsAccountId>
<gwo:sourceExperimentId>YYYY</gwo:sourceExperimentId>
<gwo:verificationCombo>YYYY</gwo:verificationCombo>

<gwo:sourceExperimentId>YYYY</gwo:sourceExperimentId>
</entry>

Then create the follow-up experiment by sending a POST with this file to the experiments feed:

curl <BASE-OPTIONS> --request POST --data "@followupexperiment.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments"

Back

Delete an experiment

Request the experiment that you wish to delete:

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}"

And then delete the experiment using:

curl <BASE-OPTIONS> --request DELETE -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}"

As with updates, the delete will fail if the gd:etag does not match.

A/B Experiments

Create a new A/B experiment

Create a text file named experiment.xml that describes your experiment. Set the gwo:analyticsAccountId to your Analytics account ID (the XXXX number in the UA-XXXX-Y string from your tracking code) and set gwo:experimentType to "A/B" as shown:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>
<title>My new A/B experiment</title>
<gwo:analyticsAccountId>XXXX</gwo:analyticsAccountId>
<gwo:experimentType>AB</gwo:experimentType>
</entry>

Then create this experiment by sending a POST with this file to the experiments feed:

curl <BASE-OPTIONS> --request POST --data "@experiment.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments"

Back

Add a new page variation to an A/B experiment

Create a text file named pagevariation.xml that describes your new AB page variation:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>
<title>Page variation name</title>
<content>http://www.website.com/pagevariation.html</content>

</entry>

Then add the following page variation by sending a POST with this file to the experiment abpagevariations feed:

curl <BASE-OPTIONS> --request POST --data "@pagevariation.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/abpagevariations"

View a single page variation in an A/B experiment

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/abpagevariations/{abPageVariationId}"

This returns (in this example: experimentId=364738, abPageVariationId=1):

<?xml version='1.0' encoding='utf-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/"D0cESH47eCp7ImA9WxVQEE0."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738/abpagevariations/1</id>
  <updated>2009-01-26T13:23:29.000-08:00</updated>
  <app:edited>2009-01-26T13:23:29.000-08:00</app:edited>
  <title>Alternate Page</title>
  <content>http://www.mywebsite.com/alternatecontent.html</content>
  <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
  <link rel='self' type='application/atom+xml'
      href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738/abpagevariations/1' />
  <gwo:abPageVariationId>1</gwo:abPageVariationId>
</entry>

Back

View all page variations in an A/B experiment

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/abpagevariations"

This returns:

<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
    xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/"D0cESH47eCp7ImA9WxVQEE0."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738/abpagevariations/all</id>
  <updated>2009-01-26T13:23:29.000-08:00</updated>
  <title>Page variation list for experiment #364738</title>
  <link rel='self' type='application/atom+xml'
      href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738/abpagevariations/all' />
  <author>
    <name>Google Analytics / Website Optimizer</name>
  </author>
  <generator version='1.0'>Google Analytics</generator>
  <openSearch:totalResults>2</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <openSearch:itemsPerPage>2</openSearch:itemsPerPage>
  <entry gd:etag='W/"D0cESH47eCp7ImA9WxVQEE0."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738/abpagevariations/0</id>
    <updated>2009-01-26T13:23:29.000-08:00</updated>
    <app:edited>2009-01-26T13:23:29.000-08:00</app:edited>
    <title>Original</title>
    <content>http://www.mywebsite.com/originalcontent.html</content>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738/abpagevariations/0' />
    <gwo:abPageVariationId>0</gwo:abPageVariationId>
  </entry>
  <entry gd:etag='W/"D0cESH47eCp7ImA9WxVQEE0."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738/abpagevariations/1</id>
    <updated>2009-01-26T13:23:29.000-08:00</updated>
    <app:edited>2009-01-26T13:23:29.000-08:00</app:edited>
    <title>Alternate Page</title>
    <content>http://www.mywebsite.com/alternatecontent.html</content>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/364738/abpagevariations/1' />
    <gwo:abPageVariationId>1</gwo:abPageVariationId>
  </entry>
</feed>

Back

Update a page variation in an A/B experiment

Create a text file named updatepagevariation.xml that contains the changes you want to make to the AB page variation:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>

<title>New page variation name</title>
<content>http://www.website.com/newpagevariation.html</content>
</entry>

Then update the page variation by sending a PUT with this file to the abpagevariations feed:

curl <BASE-OPTIONS> --request PUT --data "@pagevariation.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/abpagevariations/{abPageVariationId}"

Delete a page variation from an A/B experiment

Request the page variation that you wish to delete:

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/abpagevariations/{abPageVariationId}"

And then delete the page variation using:

curl <BASE-OPTIONS>--request DELETE -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/abpagevariations/{abPageVariationId}"

The delete will fail if the gd:etag in your delete request does not match the current etag on the server.

Back

Multivariate Experiments

Create a new multivariate experiment

Create a text file named experiment.xml that describes your experiment. Set the gwo:analyticsAccountId to your Analytics account ID (the XXXX number in the UA-XXXX-Y string from your tracking code) and set the gwo:experimentType to Multivariate as shown:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>

<title>My new experiment</title>
<gwo:analyticsAccountId>XXXX</gwo:analyticsAccountId>
<gwo:experimentType>Multivariate</gwo:experimentType>
</entry>

Then create this experiment by sending a POST with this file to the experiments feed:

curl <BASE-OPTIONS> --request POST --data "@experiment.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments"

Back

Add a new section to a multivariate experiment

Create a text file named section.xml that describes your new multivariate section. All that is needed is the section name:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>

<title>Section name</title>
</entry>

Then add this section by sending a POST with this file to the experiment API sections feed:

curl <BASE-OPTIONS> --request POST --data "@section.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections"

View a single section in a multivariate experiment

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}"

This returns (in this example: experimentId=48172, sectionId=0):

<?xml version='1.0' encoding='utf-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0</id>
  <updated>2009-06-22T09:22:27.000-07:00</updated>
  <app:edited>2009-06-22T09:22:27.000-07:00</app:edited>
  <title>Section1</title>
  <link rel='alternate' type='text/html'
      href='http://www.google.com/websiteoptimizer' />
  <link rel='self' type='application/atom+xml'
      href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0' />
  <gwo:numVariations>2</gwo:numVariations>
  <gwo:sectionBeginScript>&lt;script&gt;utmx_section("Section1")&lt;/script&gt;</gwo:sectionBeginScript>
  <gwo:sectionEndScript>&lt;/noscript&gt;</gwo:sectionEndScript>
</entry>

Back

View all sections in a multivariate experiment

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections"

This returns the following:

<?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
    xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/</id>
  <updated>2009-06-22T09:22:27.000-07:00</updated>
  <title>Section list for experiment #48172</title>
  <link rel='self' type='application/atom+xml'
      href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/' />
  <author>
    <name>Google Analytics / Website Optimizer</name>
  </author>
  <generator version='1.0'>Google Analytics</generator>
  <openSearch:totalResults>3</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <openSearch:itemsPerPage>3</openSearch:itemsPerPage>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <app:edited>2009-06-22T09:22:27.000-07:00</app:edited>
    <title>Section1</title>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0' />
    <gwo:numVariations>2</gwo:numVariations>
  </entry>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/1</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <app:edited>2009-06-22T09:22:27.000-07:00</app:edited>
    <title>Section2</title>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/1' />
    <gwo:numVariations>3</gwo:numVariations>
  </entry>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/2</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <app:edited>2009-06-22T09:22:27.000-07:00</app:edited>
    <title>Section3</title>
    <link rel='alternate' type='text/html' href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/2' />
    <gwo:numVariations>2</gwo:numVariations>
  </entry>
</feed>

Back

Update a section in a multivariate experiment

Create a text file named updatesection.xml that describes the updates to the multivariate section:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>
<title>New section name</title>
</entry>

Then update the section by sending a PUT with this file to the sections feed:

curl <BASE-OPTIONS>--request PUT --data "@updatesection.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}"

Delete a section from a multivariate experiment

Request the section that you wish to delete:

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}"

Then delete the section using:

curl <BASE-OPTIONS> --request DELETE -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}"

The delete will fail if the gd:etag in your delete request does not match the current etag on the server.

Back

Add a new variation to a section in a multivariate experiment

Create a text file named variation.xml that describes your new section variation:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>

<title>Variation name</title>
<content>variation content</content>
</entry>

Then add this variation by sending a POST with this file to the experiment section's variations feed:

curl <BASE-OPTIONS> --request POST --data "@variation.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}/variations"

View a single variation within a section of a multivariate experiment

curl <BASE-OPTIONS > -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}/variations/{variationId}

This will return (in this example: experimentId=48172, sectionId=0, variationId=1):

<?xml version='1.0' encoding='utf-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0/variations/1</id>
  <updated>2009-06-22T09:22:27.000-07:00</updated>
  <app:edited>2009-06-22T09:22:27.000-07:00</app:edited>
  <title>Section1 - variation</title>
  <content>Section1 - variation content</content>
  <link rel='alternate' type='text/html'
      href='http://www.google.com/websiteoptimizer' />
  <link rel='self' type='application/atom+xml'
      href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0/variations/1' />
</entry>

Back

View all variations within a section of a multivariate experiment

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}/variations"

This will return (in this example: experimentId=48172, sectionId=0):

 <?xml version='1.0' encoding='utf-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
    xmlns:gd='http://schemas.google.com/g/2005'
    gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
  <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0/variations/all</id>
  <updated>2009-06-22T09:22:27.000-07:00</updated>
  <title>Variation list for section #0 of experiment #48172</title>
  <link rel='self' type='application/atom+xml'
      href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0/variations/all' />
  <author>
    <name>Google Analytics / Website Optimizer</name>
  </author>
  <generator version='1.0'>Google Analytics</generator>
  <openSearch:totalResults>2</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <openSearch:itemsPerPage>2</openSearch:itemsPerPage>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0/variations/0</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <app:edited>2009-06-22T09:22:27.000-07:00</app:edited>
    <title>Section1 - Original</title>
    <content>Section1 - original content</content>
    <link rel='alternate' type='text/html'
        href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0/variations/0' />
  </entry>
  <entry gd:etag='W/"DUAARn47eCp7ImA9WxJWFkU."'>
    <id>http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0/variations/1</id>
    <updated>2009-06-22T09:22:27.000-07:00</updated>
    <app:edited>2009-06-22T09:22:27.000-07:00</app:edited>
    <title>Section1 - variation</title>
    <content>Section1 - variation content</content>
    <link rel='alternate' type='text/html'
        href='http://www.google.com/websiteoptimizer' />
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/analytics/feeds/websiteoptimizer/experiments/48172/sections/0/variations/1' />
  </entry>
</feed>

Back

Update a variation in a section in a multivariate experiment

Create a text file named updatevariation.xml that describes the changes to the section variation:

<entry xmlns='http://www.w3.org/2005/Atom'
       xmlns:gwo='http://schemas.google.com/analytics/websiteoptimizer/2009'
       xmlns:app='http://www.w3.org/2007/app'
       xmlns:gd='http://schemas.google.com/g/2005'>
<title>New variation name</title>
<content>new variation content</content>
</entry>

Then update the variation by sending a PUT with this file to the variations feed:

curl <BASE-OPTIONS> --request PUT --data "@updatevariation.xml" --header "Content-Type: application/atom+xml" -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}/variations/{variationId}"

Delete a variation from a section in a multivariate experiment

Request the variation that you wish to delete:

curl <BASE-OPTIONS> -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}/variations/{variationId}"

Then delete the variation using:

curl <BASE-OPTIONS> --request DELETE -L "https://www.google.com/analytics/feeds/websiteoptimizer/experiments/{experimentId}/sections/{sectionId}/variations/{variationId}"

The delete will fail if the gd:etag in your delete request does not match the current etag on the server.

Back