AdWordsApp.​Experiment

Represents an AdWords experiment. Experiments are used to run the changes made in a draft campaign side by side with the base campaign. For more information, refer to our guide to Drafts and Experiments.

Methods:

MemberTypeDescription
finish void Finishes the experiment.
getBaseCampaign AdWordsApp.Campaign Returns the base campaign to which this experiment belongs.
getDraft AdWordsApp.Draft Returns the draft from which this experiment is running.
getEndDate AdWordsApp.AdWordsDate Returns the experiment's end date, or null if there is no end date.
getEntityType String Returns the type of this entity as a String, in this case, "Experiment".
getExperimentCampaign AdWordsApp.Campaign Returns the experiment campaign associated with this experiment.
getId long Returns the ID of the experiment.
getName String Returns the name of the experiment.
getStartDate AdWordsApp.AdWordsDate Returns the experiment's start date.
getStatus String Returns the status of the experiment.
getTrafficSplitPercent int Returns the traffic split percent (percent of traffic directed to ads from the experiment campaign) of this experiment.
graduate void Graduates the experiment, establishing the experiment campaign as an active, full-fledged campaign immediately.
remove void Removes the experiment, thereby removing its associated experiment campaign, but not removing the associated base campaign.
setEndDate void Sets the experiment's end date from either an object containing year, month, and day fields, or an 8-digit string in YYYYMMDD format.
setName void Sets the name of the experiment.
setStartDate void Sets the experiment's start date from either an object containing year, month, and day fields, or an 8-digit string in YYYYMMDD format.
startApplying void Starts applying the experiment's changes back to the base campaign.

finish()

Finishes the experiment. A finished experiment cannot be restarted, but it can be applied, graduated, or removed.

Returns nothing.

getBaseCampaign()

Returns the base campaign to which this experiment belongs.

Return values:

TypeDescription
AdWordsApp.Campaign The base campaign to which this experiment belongs.

getDraft()

Returns the draft from which this experiment is running.

Return values:

TypeDescription
AdWordsApp.Draft The draft from which this experiment is running.

getEndDate()

Returns the experiment's end date, or null if there is no end date. For instance, if an experiment ended on May 3, 2013, this would return the following object: {year: 2013, month: 5, day: 3}.

Return values:

TypeDescription
AdWordsApp.AdWordsDate The experiment's end date, or null if there's no end date.

getEntityType()

Returns the type of this entity as a String, in this case, "Experiment".

Return values:

TypeDescription
String Type of this entity: "Experiment".

getExperimentCampaign()

Returns the experiment campaign associated with this experiment.

Return values:

TypeDescription
AdWordsApp.Campaign The experiment campaign associated with this experiment.

getId()

Returns the ID of the experiment.

Return values:

TypeDescription
long The ID of the experiment.

getName()

Returns the name of the experiment.

Return values:

TypeDescription
String Name of the experiment.

getStartDate()

Returns the experiment's start date. For instance, if an experiment started on May 3, 2013, this would return the following object: {year: 2013, month: 5, day: 3}.

Return values:

TypeDescription
AdWordsApp.AdWordsDate The experiment's start date.

getStatus()

Returns the status of the experiment. Possible values: CREATING, ACTIVE, APPLYING, APPLIED, REMOVED, UNABLE_TO_CREATE, UNABLE_TO_APPLY, GRADUATED, FINISHED.

Return values:

TypeDescription
String The status of the experiment.

getTrafficSplitPercent()

Returns the traffic split percent (percent of traffic directed to ads from the experiment campaign) of this experiment.

Return values:

TypeDescription
int The traffic split percent (percent of traffic directed to ads from the experiment campaign) of this experiment.

graduate(budget)

Graduates the experiment, establishing the experiment campaign as an active, full-fledged campaign immediately. Requires a new Budget to be set.

Returns nothing.

Arguments:

NameTypeDescription
budget AdWordsApp.Budget The budget for the new full-fledged campaign.

remove()

Removes the experiment, thereby removing its associated experiment campaign, but not removing the associated base campaign.

Returns nothing.

setEndDate(date)

Sets the experiment's end date from either an object containing year, month, and day fields, or an 8-digit string in YYYYMMDD format. For instance, experiment.setEndDate("20130503"); is equivalent to experiment.setEndDate({year: 2013, month: 5, day: 3});. The change will fail and report an error if:
  • the given date is invalid (e.g., {year: 2013, month: 5, day: 55}),
  • the given date is after the base campaign's end date,
  • it's a date in the past, or
  • it's a date after the latest allowed end date of December 30, 2037.

Returns nothing.

Arguments:

NameTypeDescription
date Object The new experiment end date.

setName(name)

Sets the name of the experiment.

Returns nothing.

Arguments:

NameTypeDescription
name String The new name for the experiment.

setStartDate(date)

Sets the experiment's start date from either an object containing year, month, and day fields, or an 8-digit string in YYYYMMDD format. For instance, experiment.setStartDate("20130503"); is equivalent to experiment.setStartDate({year: 2013, month: 5, day: 3});. The change will fail and report an error if:
  • the experiment has already started,
  • the given date is invalid (e.g., {year: 2013, month: 5, day: 55}),
  • the given date is after the experiment's end date,
  • the given date is after the base campaign's end date,
  • it's a date in the past, or
  • it's a date after the latest allowed end date of December 30, 2037.

Returns nothing.

Arguments:

NameTypeDescription
date Object The new experiment end date.

startApplying()

Starts applying the experiment's changes back to the base campaign. Does not wait for completion. View this experiment in the "All experiments" tab of the UI to see if its changes are finished being applied.

Returns nothing.

Send feedback about...

AdWords scripts
AdWords scripts
Need help? Visit our support page.