/// <summary>Snippet for GetKeywordPlanAdGroupKeyword</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetKeywordPlanAdGroupKeyword() { // Create client KeywordPlanAdGroupKeywordServiceClient keywordPlanAdGroupKeywordServiceClient = KeywordPlanAdGroupKeywordServiceClient.Create(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/keywordPlanAdGroupKeywords/[KEYWORD_PLAN_AD_GROUP_KEYWORD_ID]"; // Make the request KeywordPlanAdGroupKeyword response = keywordPlanAdGroupKeywordServiceClient.GetKeywordPlanAdGroupKeyword(resourceName); }
/// <summary>Snippet for GetKeywordPlanAdGroupKeyword</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetKeywordPlanAdGroupKeywordResourceNames() { // Create client KeywordPlanAdGroupKeywordServiceClient keywordPlanAdGroupKeywordServiceClient = KeywordPlanAdGroupKeywordServiceClient.Create(); // Initialize request argument(s) KeywordPlanAdGroupKeywordName resourceName = KeywordPlanAdGroupKeywordName.FromCustomerKeywordPlanAdGroupKeyword("[CUSTOMER_ID]", "[KEYWORD_PLAN_AD_GROUP_KEYWORD_ID]"); // Make the request KeywordPlanAdGroupKeyword response = keywordPlanAdGroupKeywordServiceClient.GetKeywordPlanAdGroupKeyword(resourceName); }
/// <summary>Snippet for GetKeywordPlanAdGroupKeywordAsync</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 GetKeywordPlanAdGroupKeywordAsync() { // Create client KeywordPlanAdGroupKeywordServiceClient keywordPlanAdGroupKeywordServiceClient = await KeywordPlanAdGroupKeywordServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER]/keywordPlanAdGroupKeywords/[KEYWORD_PLAN_AD_GROUP_KEYWORD]"; // Make the request KeywordPlanAdGroupKeyword response = await keywordPlanAdGroupKeywordServiceClient.GetKeywordPlanAdGroupKeywordAsync(resourceName); }
/// <summary>Snippet for GetKeywordPlanAdGroupKeywordAsync</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 GetKeywordPlanAdGroupKeywordResourceNamesAsync() { // Create client KeywordPlanAdGroupKeywordServiceClient keywordPlanAdGroupKeywordServiceClient = await KeywordPlanAdGroupKeywordServiceClient.CreateAsync(); // Initialize request argument(s) KeywordPlanAdGroupKeywordName resourceName = KeywordPlanAdGroupKeywordName.FromCustomerKeywordPlanAdGroupKeyword("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP_KEYWORD]"); // Make the request KeywordPlanAdGroupKeyword response = await keywordPlanAdGroupKeywordServiceClient.GetKeywordPlanAdGroupKeywordAsync(resourceName); }
/// <summary>Snippet for GetKeywordPlanAdGroupKeywordAsync</summary> public async Task GetKeywordPlanAdGroupKeywordAsync() { // Snippet: GetKeywordPlanAdGroupKeywordAsync(string, CallSettings) // Additional: GetKeywordPlanAdGroupKeywordAsync(string, CancellationToken) // Create client KeywordPlanAdGroupKeywordServiceClient keywordPlanAdGroupKeywordServiceClient = await KeywordPlanAdGroupKeywordServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER]/keywordPlanAdGroupKeywords/[KEYWORD_PLAN_AD_GROUP_KEYWORD]"; // Make the request KeywordPlanAdGroupKeyword response = await keywordPlanAdGroupKeywordServiceClient.GetKeywordPlanAdGroupKeywordAsync(resourceName); // End snippet }
/// <summary>Snippet for GetKeywordPlanAdGroupKeyword</summary> public void GetKeywordPlanAdGroupKeywordRequestObject() { // Snippet: GetKeywordPlanAdGroupKeyword(GetKeywordPlanAdGroupKeywordRequest, CallSettings) // Create client KeywordPlanAdGroupKeywordServiceClient keywordPlanAdGroupKeywordServiceClient = KeywordPlanAdGroupKeywordServiceClient.Create(); // Initialize request argument(s) GetKeywordPlanAdGroupKeywordRequest request = new GetKeywordPlanAdGroupKeywordRequest { ResourceNameAsKeywordPlanAdGroupKeywordName = KeywordPlanAdGroupKeywordName.FromCustomerKeywordPlanAdGroupKeyword("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP_KEYWORD]"), }; // Make the request KeywordPlanAdGroupKeyword response = keywordPlanAdGroupKeywordServiceClient.GetKeywordPlanAdGroupKeyword(request); // End snippet }
/// <summary>Snippet for GetKeywordPlanAdGroupKeywordAsync</summary> public async Task GetKeywordPlanAdGroupKeywordResourceNamesAsync() { // Snippet: GetKeywordPlanAdGroupKeywordAsync(KeywordPlanAdGroupKeywordName, CallSettings) // Additional: GetKeywordPlanAdGroupKeywordAsync(KeywordPlanAdGroupKeywordName, CancellationToken) // Create client KeywordPlanAdGroupKeywordServiceClient keywordPlanAdGroupKeywordServiceClient = await KeywordPlanAdGroupKeywordServiceClient.CreateAsync(); // Initialize request argument(s) KeywordPlanAdGroupKeywordName resourceName = KeywordPlanAdGroupKeywordName.FromCustomerKeywordPlanAdGroupKeyword("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP_KEYWORD]"); // Make the request KeywordPlanAdGroupKeyword response = await keywordPlanAdGroupKeywordServiceClient.GetKeywordPlanAdGroupKeywordAsync(resourceName); // End snippet }
/// <summary> /// Creates keywords for the keyword plan. /// </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="planAdGroupResource">The resource name of the ad group under which the /// keyword is created.</param> private static void CreateKeywordPlanAdGroupKeywords(GoogleAdsClient client, long customerId, string planAdGroupResource) { // Get the KeywordPlanAdGroupKeywordService. KeywordPlanAdGroupKeywordServiceClient serviceClient = client.GetService( Services.V6.KeywordPlanAdGroupKeywordService); // Create the adgroup level keywords for keyword plan. KeywordPlanAdGroupKeyword kpAdGroupKeyword1 = new KeywordPlanAdGroupKeyword() { KeywordPlanAdGroup = planAdGroupResource, CpcBidMicros = 2_000_000L, MatchType = KeywordMatchType.Broad, Text = "mars cruise" }; KeywordPlanAdGroupKeyword kpAdGroupKeyword2 = new KeywordPlanAdGroupKeyword() { KeywordPlanAdGroup = planAdGroupResource, CpcBidMicros = 1_500_000L, MatchType = KeywordMatchType.Phrase, Text = "cheap cruise" }; KeywordPlanAdGroupKeyword kpAdGroupKeyword3 = new KeywordPlanAdGroupKeyword() { KeywordPlanAdGroup = planAdGroupResource, CpcBidMicros = 1_990_000L, MatchType = KeywordMatchType.Exact, Text = "jupiter cruise" }; KeywordPlanAdGroupKeyword[] kpAdGroupKeywords = new KeywordPlanAdGroupKeyword[] { kpAdGroupKeyword1, kpAdGroupKeyword2, kpAdGroupKeyword3 }; // Create an operation for each plan keyword. List <KeywordPlanAdGroupKeywordOperation> operations = new List <KeywordPlanAdGroupKeywordOperation>(); foreach (KeywordPlanAdGroupKeyword kpAdGroupKeyword in kpAdGroupKeywords) { operations.Add(new KeywordPlanAdGroupKeywordOperation { Create = kpAdGroupKeyword }); } // Add the keywords. MutateKeywordPlanAdGroupKeywordsResponse response = serviceClient.MutateKeywordPlanAdGroupKeywords(customerId.ToString(), operations); // Display the results. foreach (MutateKeywordPlanAdGroupKeywordResult result in response.Results) { Console.WriteLine( $"Created ad group keyword for keyword plan: {result.ResourceName}."); } return; }