/// <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; }
/// <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); }
/// <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); }
/// <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); }
/// <summary>Snippet for MutateKeywordPlanCampaignKeywords</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateKeywordPlanCampaignKeywords() { // Create client KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = KeywordPlanCampaignKeywordServiceClient.Create(); // Initialize request argument(s) string customerId = ""; IEnumerable <KeywordPlanCampaignKeywordOperation> operations = new KeywordPlanCampaignKeywordOperation[] { new KeywordPlanCampaignKeywordOperation(), }; // Make the request MutateKeywordPlanCampaignKeywordsResponse response = keywordPlanCampaignKeywordServiceClient.MutateKeywordPlanCampaignKeywords(customerId, operations); }
/// <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 }
/// <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 }
/// <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 }
/// <summary>Snippet for MutateKeywordPlanCampaignKeywordsAsync</summary> public async Task MutateKeywordPlanCampaignKeywordsAsync() { // Snippet: MutateKeywordPlanCampaignKeywordsAsync(string, IEnumerable<KeywordPlanCampaignKeywordOperation>, CallSettings) // Additional: MutateKeywordPlanCampaignKeywordsAsync(string, IEnumerable<KeywordPlanCampaignKeywordOperation>, CancellationToken) // Create client KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = await KeywordPlanCampaignKeywordServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; IEnumerable <KeywordPlanCampaignKeywordOperation> operations = new KeywordPlanCampaignKeywordOperation[] { new KeywordPlanCampaignKeywordOperation(), }; // Make the request MutateKeywordPlanCampaignKeywordsResponse response = await keywordPlanCampaignKeywordServiceClient.MutateKeywordPlanCampaignKeywordsAsync(customerId, operations); // End snippet }
/// <summary>Snippet for MutateKeywordPlanCampaignKeywords</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateKeywordPlanCampaignKeywordsRequestObject() { // Create client KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = KeywordPlanCampaignKeywordServiceClient.Create(); // Initialize request argument(s) MutateKeywordPlanCampaignKeywordsRequest request = new MutateKeywordPlanCampaignKeywordsRequest { CustomerId = "", Operations = { new KeywordPlanCampaignKeywordOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateKeywordPlanCampaignKeywordsResponse response = keywordPlanCampaignKeywordServiceClient.MutateKeywordPlanCampaignKeywords(request); }
/// <summary>Snippet for MutateKeywordPlanCampaignKeywordsAsync</summary> public async Task MutateKeywordPlanCampaignKeywordsRequestObjectAsync() { // Snippet: MutateKeywordPlanCampaignKeywordsAsync(MutateKeywordPlanCampaignKeywordsRequest, CallSettings) // Additional: MutateKeywordPlanCampaignKeywordsAsync(MutateKeywordPlanCampaignKeywordsRequest, CancellationToken) // Create client KeywordPlanCampaignKeywordServiceClient keywordPlanCampaignKeywordServiceClient = await KeywordPlanCampaignKeywordServiceClient.CreateAsync(); // Initialize request argument(s) MutateKeywordPlanCampaignKeywordsRequest request = new MutateKeywordPlanCampaignKeywordsRequest { CustomerId = "", Operations = { new KeywordPlanCampaignKeywordOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateKeywordPlanCampaignKeywordsResponse response = await keywordPlanCampaignKeywordServiceClient.MutateKeywordPlanCampaignKeywordsAsync(request); // End snippet }