Beispiel #1
0
        /// <summary>
        /// Creates campaign negative keywords for the keyword plan.
        /// </summary>
        /// <param name="client">he Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        /// <param name="planCampaignResource">The resource name of the campaign under which the
        /// negative keyword is created.</param>
        private static void CreateKeywordPlanCampaignNegativeKeywords(GoogleAdsClient client,
                                                                      long customerId, string planCampaignResource)
        {
            // Get the KeywordPlanCampaignKeywordService.
            KeywordPlanCampaignKeywordServiceClient service = client.GetService(
                Services.V6.KeywordPlanCampaignKeywordService);

            // Create the campaign negative keyword for the keyword plan.
            KeywordPlanCampaignKeyword kpCampaignNegativeKeyword = new KeywordPlanCampaignKeyword()
            {
                KeywordPlanCampaign = planCampaignResource,
                MatchType           = KeywordMatchType.Broad,
                Text     = "moon walk",
                Negative = true
            };

            KeywordPlanCampaignKeywordOperation operation = new KeywordPlanCampaignKeywordOperation
            {
                Create = kpCampaignNegativeKeyword
            };

            // Add the campaign negative keyword.
            MutateKeywordPlanCampaignKeywordsResponse response =
                service.MutateKeywordPlanCampaignKeywords(customerId.ToString(),
                                                          new KeywordPlanCampaignKeywordOperation[] { operation });

            // Display the result.
            MutateKeywordPlanCampaignKeywordResult result = response.Results[0];

            Console.WriteLine("Created campaign negative keyword for keyword plan: " +
                              $"{result.ResourceName}.");
            return;
        }
Beispiel #2
0
 /// <summary>Snippet for GetKeywordPlanCampaignKeyword</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetKeywordPlanCampaignKeywordResourceNames()
 {
     // Create client
     KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = KeywordPlanCampaignKeywordServiceClient.Create();
     // Initialize request argument(s)
     KeywordPlanCampaignKeywordName resourceName = KeywordPlanCampaignKeywordName.FromCustomerKeywordPlanCampaignKeyword("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN_KEYWORD]");
     // Make the request
     KeywordPlanCampaignKeyword response = keywordPlanCampaignKeywordServiceClient.GetKeywordPlanCampaignKeyword(resourceName);
 }
Beispiel #3
0
 /// <summary>Snippet for GetKeywordPlanCampaignKeyword</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetKeywordPlanCampaignKeyword()
 {
     // Create client
     KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = KeywordPlanCampaignKeywordServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER_ID]/keywordPlanCampaignKeywords/[KEYWORD_PLAN_CAMPAIGN_KEYWORD_ID]";
     // Make the request
     KeywordPlanCampaignKeyword response = keywordPlanCampaignKeywordServiceClient.GetKeywordPlanCampaignKeyword(resourceName);
 }
Beispiel #4
0
        /// <summary>Snippet for GetKeywordPlanCampaignKeywordAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetKeywordPlanCampaignKeywordAsync()
        {
            // Create client
            KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = await KeywordPlanCampaignKeywordServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/keywordPlanCampaignKeywords/[KEYWORD_PLAN_CAMPAIGN_KEYWORD]";
            // Make the request
            KeywordPlanCampaignKeyword response = await keywordPlanCampaignKeywordServiceClient.GetKeywordPlanCampaignKeywordAsync(resourceName);
        }
        /// <summary>Snippet for GetKeywordPlanCampaignKeywordAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetKeywordPlanCampaignKeywordResourceNamesAsync()
        {
            // Create client
            KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = await KeywordPlanCampaignKeywordServiceClient.CreateAsync();

            // Initialize request argument(s)
            KeywordPlanCampaignKeywordName resourceName = KeywordPlanCampaignKeywordName.FromCustomerKeywordPlanCampaignKeyword("[CUSTOMER_ID]", "[KEYWORD_PLAN_CAMPAIGN_KEYWORD_ID]");
            // Make the request
            KeywordPlanCampaignKeyword response = await keywordPlanCampaignKeywordServiceClient.GetKeywordPlanCampaignKeywordAsync(resourceName);
        }
Beispiel #6
0
        /// <summary>Snippet for GetKeywordPlanCampaignKeywordAsync</summary>
        public async Task GetKeywordPlanCampaignKeywordAsync()
        {
            // Snippet: GetKeywordPlanCampaignKeywordAsync(string, CallSettings)
            // Additional: GetKeywordPlanCampaignKeywordAsync(string, CancellationToken)
            // Create client
            KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = await KeywordPlanCampaignKeywordServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER_ID]/keywordPlanCampaignKeywords/[KEYWORD_PLAN_CAMPAIGN_KEYWORD_ID]";
            // Make the request
            KeywordPlanCampaignKeyword response = await keywordPlanCampaignKeywordServiceClient.GetKeywordPlanCampaignKeywordAsync(resourceName);

            // End snippet
        }
Beispiel #7
0
 /// <summary>Snippet for GetKeywordPlanCampaignKeyword</summary>
 public void GetKeywordPlanCampaignKeywordRequestObject()
 {
     // Snippet: GetKeywordPlanCampaignKeyword(GetKeywordPlanCampaignKeywordRequest, CallSettings)
     // Create client
     KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = KeywordPlanCampaignKeywordServiceClient.Create();
     // Initialize request argument(s)
     GetKeywordPlanCampaignKeywordRequest request = new GetKeywordPlanCampaignKeywordRequest
     {
         ResourceNameAsKeywordPlanCampaignKeywordName = KeywordPlanCampaignKeywordName.FromCustomerKeywordPlanCampaignKeyword("[CUSTOMER_ID]", "[KEYWORD_PLAN_CAMPAIGN_KEYWORD_ID]"),
     };
     // Make the request
     KeywordPlanCampaignKeyword response = keywordPlanCampaignKeywordServiceClient.GetKeywordPlanCampaignKeyword(request);
     // End snippet
 }
Beispiel #8
0
        /// <summary>Snippet for GetKeywordPlanCampaignKeywordAsync</summary>
        public async Task GetKeywordPlanCampaignKeywordResourceNamesAsync()
        {
            // Snippet: GetKeywordPlanCampaignKeywordAsync(KeywordPlanCampaignKeywordName, CallSettings)
            // Additional: GetKeywordPlanCampaignKeywordAsync(KeywordPlanCampaignKeywordName, CancellationToken)
            // Create client
            KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = await KeywordPlanCampaignKeywordServiceClient.CreateAsync();

            // Initialize request argument(s)
            KeywordPlanCampaignKeywordName resourceName = KeywordPlanCampaignKeywordName.FromCustomerKeywordPlanCampaignKeyword("[CUSTOMER_ID]", "[KEYWORD_PLAN_CAMPAIGN_KEYWORD_ID]");
            // Make the request
            KeywordPlanCampaignKeyword response = await keywordPlanCampaignKeywordServiceClient.GetKeywordPlanCampaignKeywordAsync(resourceName);

            // End snippet
        }