ExperimentOperation experimentOperation = new ExperimentOperation();
experimentOperation.setOperand(experiment);
experimentOperation.setOperator(Operator.ADD);
// Add experiment.
ExperimentReturnValue result =
experimentService.mutate(new ExperimentOperation[]{experimentOperation});
if (result.getValue() != null) {
for(Experiment experimentResult : result.getValue()) {
System.out.println("Experiment with name \"" + experimentResult.getName()
+ "\" and id \"" + experimentResult.getId() + "\" was added.");
}
} else {
System.out.println ("No experiments were added.");
return;
}
Long experimentId = result.getValue()[0].getId();
// Set ad group for the experiment.
AdGroup adGroup = new AdGroup();
adGroup.setId(adGroupId);