// Create experiment bid multiplier rule that will modify ad group bid for
// the experiment.
ManualCPCAdGroupExperimentBidMultipliers adGroupExperimentBidMultipliers =
new ManualCPCAdGroupExperimentBidMultipliers();
adGroupExperimentBidMultipliers.setMaxCpcMultiplier(new BidMultiplier(1.5, null));
// Set experiment data to the ad group.
AdGroupExperimentData adGroupExperimentData = new AdGroupExperimentData();
adGroupExperimentData.setExperimentId(experimentId);
adGroupExperimentData.setExperimentDeltaStatus(ExperimentDeltaStatus.MODIFIED);
adGroupExperimentData.setExperimentBidMultipliers(adGroupExperimentBidMultipliers);
adGroup.setExperimentData(adGroupExperimentData);
// Create operation.
AdGroupOperation adGroupOperation = new AdGroupOperation();
adGroupOperation.setOperand(adGroup);
adGroupOperation.setOperator(Operator.SET);
// Update ad group.
adGroup = adGroupService.mutate(new AdGroupOperation[] {adGroupOperation}).getValue()[0];
System.out.println("Ad group with name \"" + adGroup.getName() + "\" and id \""
+ adGroup.getId() + "\" was updated for the experiment.");
// Set ad group criterion for the experiment.
BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();
adGroupCriterion.setCriterion(new Criterion(criterionId, null, null));
adGroupCriterion.setAdGroupId(adGroupId);
// Create experiment bid multiplier rule that will modify ad group bid for
// the experiment.
ManualCPCAdGroupCriterionExperimentBidMultiplier adGroupCriterionExperimentBidMultiplier =
new ManualCPCAdGroupCriterionExperimentBidMultiplier();
adGroupCriterionExperimentBidMultiplier.setMaxCpcMultiplier(new BidMultiplier(1.5, null));
// Set experiment data to the ad group.
BiddableAdGroupCriterionExperimentData adGroupCriterionExperimentData =
new BiddableAdGroupCriterionExperimentData();
adGroupCriterionExperimentData.setExperimentId(experimentId);