Create experiments

Experiments are an interface to manage experimental campaigns related to a base campaign. Experiment campaigns are full-fledged campaigns that can serve ads and accrue clicks, cost, and other metrics.

The first step in running an experiment using the Google Ads API is to create an Experiment. This resource defines some key information about the experiment you want to run, such as a name and experiment type. You do not specify any of the campaigns involved in the experiment at this step.

Here's an overview of some key fields for an Experiment:

  • name: Each experiment must have a unique name.
  • description: An optional field that you can use to reference later. Does not affect how the experiment runs.
  • suffix: The suffix will be appended to the end of the names of the treatment campaigns so you can distinguish them from the control campaign. These concepts will be explained further in the experiment arms page.
  • type: What type of experiment to run. There are many types here, but most of them are system experiments. For your custom experiments, you'll want to specify either SEARCH_CUSTOM or DISPLAY_CUSTOM.
  • status: When creating an experiment, set this field to SETUP. Later on, once you begin the experiment, this field will let you check what it's currently doing
  • start_date and end_date: Specify when the experiment should start and end.

Here's an example of creating an experiment:

operation = client.operation.create_resource.experiment do |e| = 'Custom Search Experiment'
  e.type = :SEARCH_CUSTOM
  e.suffix = '(experimental)'
  e.status = :SETUP

response = client.service.experiment.mutate_experiments(
  customer_id: customer_id,
  operations: [operation],