/// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        /// <param name="campaignExperimentId">ID of the campaign experiment to graduate.</param>
        public void Run(GoogleAdsClient client, long customerId, long campaignExperimentId)
        {
            // Get the CampaignExperimentService.
            CampaignExperimentServiceClient campaignExperimentService = client.GetService(
                Services.V5.CampaignExperimentService);

            try
            {
                // Graduating a campaign experiment requires a new budget. Since the budget for
                // the base campaign has explicitly_shared set to false, the budget cannot
                // be shared with the campaign after it is made independent by graduation.
                string budgetResourceName = CreateBudget(client, customerId);

                // Prints out some information about the created campaign budget.
                Console.WriteLine($"Created new budget with resource name '{budgetResourceName}' " +
                                  $"for adding to the experiment campaign during graduation.");

                // Graduates the experiment campaign using the campaign budget created above.
                GraduateCampaignExperimentResponse response =
                    campaignExperimentService.GraduateCampaignExperiment(
                        ResourceNames.CampaignExperiment(customerId, campaignExperimentId),
                        budgetResourceName);
                Console.WriteLine($"Campaign with resource name '{response.GraduatedCampaign}' " +
                                  $"is now graduated.");
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
                throw;
            }
        }
 /// <summary>Snippet for GraduateCampaignExperiment</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GraduateCampaignExperiment()
 {
     // Create client
     CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.Create();
     // Initialize request argument(s)
     string campaignExperiment = "";
     string campaignBudget = "";
     // Make the request
     GraduateCampaignExperimentResponse response = campaignExperimentServiceClient.GraduateCampaignExperiment(campaignExperiment, campaignBudget);
 }
 /// <summary>Snippet for GraduateCampaignExperiment</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GraduateCampaignExperimentRequestObject()
 {
     // Create client
     CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.Create();
     // Initialize request argument(s)
     GraduateCampaignExperimentRequest request = new GraduateCampaignExperimentRequest
     {
         CampaignExperiment = "",
         CampaignBudget     = "",
     };
     // Make the request
     GraduateCampaignExperimentResponse response = campaignExperimentServiceClient.GraduateCampaignExperiment(request);
 }
Esempio n. 4
0
 /// <summary>Snippet for GraduateCampaignExperiment</summary>
 public void GraduateCampaignExperimentRequestObject()
 {
     // Snippet: GraduateCampaignExperiment(GraduateCampaignExperimentRequest, CallSettings)
     // Create client
     CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.Create();
     // Initialize request argument(s)
     GraduateCampaignExperimentRequest request = new GraduateCampaignExperimentRequest
     {
         CampaignExperiment = "",
         CampaignBudget     = "",
         ValidateOnly       = false,
     };
     // Make the request
     GraduateCampaignExperimentResponse response = campaignExperimentServiceClient.GraduateCampaignExperiment(request);
     // End snippet
 }