AdWordsApp.​ExperimentBuilder

Builder for Experiment objects.

Example usage:

 // Create an experiment builder.
 var experimentBuilder = AdWordsApp.drafts().get().next().newExperimentBuilder();

 // Create the experiment. Note that startBuilding() returns nothing.
 experimentBuilder
   .withName("Sample Experiment")                // required
   .withTrafficSplitPercent(50)                  // required
   .startBuilding();

 //Head to the "All experiments" tab of the UI to track the new experiment's creation.

Methods:

MemberTypeDescription
startBuilding void Starts creating an Experiment.
withEndDate 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.
withName AdWordsApp.ExperimentBuilder Sets the name of the new experiment to the specified value.
withStartDate AdWordsApp.ExperimentBuilder Sets the experiment's start date from either an object containing year, month, and day fields, or an 8-digit string in YYYYMMDD format.
withTrafficSplitPercent AdWordsApp.ExperimentBuilder Sets the traffic split percent (percent of traffic directed to ads from the experiment campaign) of the new experiment to the specified value.

startBuilding()

Starts creating an Experiment. Returns nothing, unlike calls to Builder.build(). Navigate to the "All experiments" tab of the UI to track the new experiment's creation.

Returns nothing.

withEndDate(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. This field is optional and will default to the end date of the base campaign if not specified. For instance, experimentBuilder.withEndDate("20180503"); is equivalent to experimentBuilder.withEndDate({year: 2018, month: 5, day: 3});. The change will fail and report an error if:
  • the given date is invalid (e.g., {year: 2018, 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.

withName(name)

Sets the name of the new experiment to the specified value. Required before building.

Arguments:

NameTypeDescription
name String Experiment name.

Return values:

TypeDescription
AdWordsApp.ExperimentBuilder Experiment builder with the specified name.

withStartDate(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. This field is optional and will default to the start date of the base campaign if not specified. For instance, experimentBuilder.withStartDate("20180503"); is equivalent to experimentBuilder.withStartDate({year: 2018, month: 5, day: 3});. The change will fail and report an error if:
  • the given date is invalid (e.g., {year: 2018, 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.

Arguments:

NameTypeDescription
date Object Experiment start date.

Return values:

TypeDescription
AdWordsApp.ExperimentBuilder Experiment builder with the specified start date.

withTrafficSplitPercent(trafficSplitPercent)

Sets the traffic split percent (percent of traffic directed to ads from the experiment campaign) of the new experiment to the specified value. Must be an integer between 0 and 100, not inclusive. Required before building.

Arguments:

NameTypeDescription
trafficSplitPercent int Experiment traffic split percent.

Return values:

TypeDescription
AdWordsApp.ExperimentBuilder Experiment builder with the specified traffic split percent.

发送以下问题的反馈:

此网页
Google Ads scripts
Google Ads scripts
需要帮助?请访问我们的支持页面