Create experiment arms

Once you've created an experiment, you need to create multiple experiment arms in order to give the experiment more information about what exactly you're testing.

The ExperimentArm represents one part of the comparison you're performing for the experiment. All experiments must always have exactly one control arm. This arm will be an existing campaign, and is the basis against which you will compare the other arm. The other arm is called a treatment arm, and in these arms you will be able to make some changes to the campaign before beginning the experiment.

The ExperimentArm also contains the traffic_split setting. This lets you specify what percentage of traffic will be directed to each arm of the experiment. Each arm must specify a traffic split, and the sum of traffic split values in all arms must add up to 100.

Because of this restriction to traffic split, all experiment arms must be created in the same request:

operations = []
operations << client.operation.create_resource.experiment_arm do |ea|
  ea.trial = client.path.experiment(customer_id, experiment_id) = 'control arm'
  ea.control = true
  ea.traffic_split = 40
  ea.campaigns << client.path.campaign(customer_id, campaign_id)
operations << client.operation.create_resource.experiment_arm do |ea|
  ea.trial = client.path.experiment(customer_id, experiment_id) = 'treatment arm'
  ea.control = false
  ea.traffic_split = 60

response = client.service.experiment_arm.mutate_experiment_arms(
  customer_id: customer_id,
  operations: operations,

A few key points about the example above:

  • The name of each arm must be unique within the Experiment
  • Exactly one arm must have control set to true. All other arms must have it set to false.
  • The traffic_split must add up to 100 across all arms.
  • Only the control arm specifies campaigns. Only one campaign may be specified.

Treatment arms

Once you've created the experiment arms, the treatment arm (that is, the arm where control is set to false) will automatically populate its in_design_campaigns. You need to fetch that info from GoogleAdsService to make changes to the campaign for the treatment arm.

SELECT experiment_arm.in_design_campaigns
FROM experiment_arm
WHERE experiment_arm.resource_name = "customers/xxxx/experimentArms/xxxx"

Replace the resource name in the above query with the resource name for the treatment arm you just created.

You can treat these in design campaigns as regular campaigns. Make whatever changes you want to test in your experiment to these campaigns. The control campaign will not be affected. Once you schedule the experiment, these changes will be materialized into a real campaign that can serve ads.

These "in design" campaigns are technically draft campaigns. If you want to find them in GoogleAdsService, you will need to include the include_drafts=true parameter in the query.

At least one change must be made to the in design campaign before you will be able to schedule the experiment.