public void Run(AdWordsUser user, long experimentId)
{
// Get the ExperimentService.
ExperimentService experimentService =
(ExperimentService) user.GetService(AdWordsService.v201306.ExperimentService);
// Set experiment's status to PROMOTED.
Experiment experiment = new Experiment();
experiment.id = experimentId;
experiment.status = ExperimentStatus.PROMOTED;
// Create the operation.
ExperimentOperation operation = new ExperimentOperation();
operation.@operator = Operator.SET;
operation.operand = experiment;
try {
// Update the experiment.
ExperimentReturnValue retVal = experimentService.mutate(
new ExperimentOperation[] {operation});
// Display the results.
if (retVal != null && retVal.value != null && retVal.value.Length > 0) {
Experiment promotedExperiment = retVal.value[0];
Console.WriteLine("Experiment with name = \"{0}\" and id = \"{1}\" was promoted.\n",
promotedExperiment.name, promotedExperiment.id);
} else {
Console.WriteLine("No experiments were promoted.");
}
} catch (Exception ex) {
throw new System.ApplicationException("Failed to promote experiment.", ex);
}
}