django-gwo v0.1 documentation

gwo.websiteoptimizer.client

Ways of accessing the Google Website Optimizer API

class CombinationQuery(experiment, combination_id=None, **kwargs)

Query all combinations or a specific combination of a multivariate experiment

Parameters:
  • experiment (int, str, unicode or ExperimentEntry) – The experiment
  • combination_id (int, str, or unicode) – The optional id of a specific combination
path

The path section of the URI to this query

class ExperimentQuery(exp_id=None, **kwargs)

Query all experiments or a specific experiment

Parameters:exp_id (None, int, str, unicode. Default: None) – The experiment id, if a specific experiment is requested.
path

The path section of the URI to this query

class SectionQuery(experiment, section_id=None, **kwargs)

Query all sections or a specific section of an experiment

Parameters:
  • experiment (int, str, unicode or ExperimentEntry) – The experiment.
  • section_id (int, str, or unicode) – The optional, 0-based id of a specific section.
path

The path section of the URI to this query

class VariationQuery(*args, **kwargs)

Query all variations or a specific variation of a section of an experiment

In order to be flexible with the parameters, you can query variations with:

  • experiment_id and section_id and optionally variation_id
  • section=SectionEntry and optionally variation_id

All variations of section 1 of experiment 12345:

VariationQuery('12345', '1')
VariationQuery(experiment_id='12345', section_id='1')
VariationQuery(section1) # Assuming section1 is a SectionEntry instance
VariationQuery(section=section1) # Assuming section1 is a SectionEntry instance

Variation 0 of section 1 of experiment 12345:

VariationQuery('12345', '1', '0')
VariationQuery(experiment_id='12345', section_id='1', variation_id='0')
VariationQuery(section1, '0') # Assuming section1 is a SectionEntry instance
VariationQuery(section=section1, variation='0') # Assuming section1 is a SectionEntry instance
path

The path section of the URI to this query

class WebsiteOptimizerClient(*args, **kwargs)

Client extension for the Google Website Optimizer API service.

add_experiment(exp_type, analytics_acct, test_url, goal_url, title, **kwargs)

Create a new experiment

On failure, a RequestError is raised of the form:

{'status': HTTP status code from server, 
'reason': HTTP reason from the server, 
'body': HTTP body of the server's response}
Parameters:
  • exp_type (str) – ‘AB’ or ‘Multivariate’
  • analytics_acct (str) – The Google Analytics account to use
  • test_url (str) – The test page URL
  • goal_url (str) – The goal page URL
  • title (str) – The name of the experiment
Returns:

ExperimentEntry

Raises :

RequestError

add_section(experiment, title, **kwargs)

Add a section to an experiment

Parameters:
  • experiment (int, str, unicode or ExperimentEntry) – The experiment which to add the section
  • title (str) – The name of the section
add_variation(section, title, content, **kwargs)

Add a variation to an experiment section.

Parameters:
  • section (SectionEntry or SectionQuery) – The section which to add the variation
  • title (str) – The name of the variation
  • content (str) – The content of the variation (what goes on the page)
delete(entry_or_uri, auth_token=None, force=False, **kwargs)

Deletes the item specified by entry_or_uri.

Parameters:entry_or_uri – Either an Entry or Query object
get_combination(feed_uri, auth_token=None, **kwargs)

Information about a single combination within an experiment

Parameters:feed_uri (CombinationQuery) – The CombinationQuery to specify the combination
Returns:CombinationEntry
get_combinations(feed_uri, auth_token=None, **kwargs)

A list of all combinations in the specified experiment

Parameters:feed_uri (CombinationQuery) – The CombinationQuery to get all the combinations
Returns:CombinationFeed
get_experiment(feed_uri, auth_token=None, **kwargs)

Get a specific experiment.

Parameters:feed_uri (ExperimentQuery) – The REST URI to get the feeds
Returns:ExperimentEntry
get_experiments(feed_uri=None, auth_token=None, **kwargs)

Get all the experiments the current user has access to.

Parameters:feed_uri (None, ExperimentQuery) – The REST URI to get the feeds. Defaults to all experiments
Returns:ExperimentFeed
get_section(feed_uri, auth_token=None, **kwargs)

Get a section for an experiment.

Parameters:feed_uri (SectionQuery) – The SectionQuery from which to get the SectionEntry
Returns:SectionEntry
get_sections(feed_uri, auth_token=None, **kwargs)

Get a section feed for an experiment.

Parameters:feed_uri (SectionQuery) – The SectionQuery from which to get the feed
Returns:SectionFeed
get_variation(feed_uri, auth_token=None, **kwargs)

Get a variation for an experiment section.

Parameters:feed_uri (VariationQuery) – The VariationQuery from which to get the VariationEntry
Returns:VariationEntry
get_variations(feed_uri, auth_token=None, **kwargs)

Get a variation feed for an experiment section.

Parameters:feed_uri (VariationQuery) – The VariationQuery from which to get the VariationFeed
Returns:VariationFeed
pause_experiment(feed_uri, **kwargs)

Pause an experiment

Parameters:feed_uri (ExperimentQuery) – The REST URI to get the feeds
start_experiment(feed_uri, **kwargs)

Start an experiment

Parameters:feed_uri (ExperimentQuery) – The REST URI to get the feeds
stop_experiment(feed_uri, **kwargs)

Stop an experiment

Parameters:feed_uri (ExperimentQuery) – The REST URI to get the feeds
update(entry, auth_token=None, force=False, **kwargs)

Edits the entry on the server by sending the XML for this entry.

Performs a PUT and converts the response to a new entry object with a matching class to the entry passed in.

Parameters:
  • entry – The Atom Entry object.
  • auth_token – Optional authentication token
  • force (boolean) –

    Whether an update should be forced. Default: False.

    Normally, if a change has been made since the passed in entry was obtained, the server will not overwrite the entry since the changes were based on an obsolete version of the entry. Setting force to True will cause the update to silently overwrite whatever version is present.

Returns:

A new Entry object of a matching type to the entry which was passed in.