/// <summary> /// Creates the ad group 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="planCampaignResource">The resource name of the campaign under which the /// ad group is created.</param> /// <returns>The newly created ad group resource.</returns> private string CreateKeywordPlanAdGroup(GoogleAdsClient client, long customerId, string planCampaignResource) { // Get the KeywordPlanAdGroupService. KeywordPlanAdGroupServiceClient serviceClient = client.GetService( Services.V6.KeywordPlanAdGroupService); // Create the keyword plan ad group. KeywordPlanAdGroup adGroup = new KeywordPlanAdGroup() { KeywordPlanCampaign = planCampaignResource, Name = "Keyword plan ad group #" + ExampleUtilities.GetRandomString(), CpcBidMicros = 2_500_000L }; KeywordPlanAdGroupOperation operation = new KeywordPlanAdGroupOperation() { Create = adGroup }; // Add the ad group. MutateKeywordPlanAdGroupsResponse response = serviceClient.MutateKeywordPlanAdGroups( customerId.ToString(), new KeywordPlanAdGroupOperation[] { operation }); // Display the result. String planAdGroupResource = response.Results[0].ResourceName; Console.WriteLine($"Created ad group for keyword plan: {planAdGroupResource}."); return(planAdGroupResource); }
/// <summary>Snippet for GetKeywordPlanAdGroup</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetKeywordPlanAdGroup() { // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = KeywordPlanAdGroupServiceClient.Create(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER]/keywordPlanAdGroups/[KEYWORD_PLAN_AD_GROUP]"; // Make the request KeywordPlanAdGroup response = keywordPlanAdGroupServiceClient.GetKeywordPlanAdGroup(resourceName); }
/// <summary>Snippet for GetKeywordPlanAdGroup</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetKeywordPlanAdGroupResourceNames() { // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = KeywordPlanAdGroupServiceClient.Create(); // Initialize request argument(s) KeywordPlanAdGroupName resourceName = KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER_ID]", "[KEYWORD_PLAN_AD_GROUP_ID]"); // Make the request KeywordPlanAdGroup response = keywordPlanAdGroupServiceClient.GetKeywordPlanAdGroup(resourceName); }
/// <summary>Snippet for GetKeywordPlanAdGroupAsync</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 GetKeywordPlanAdGroupResourceNamesAsync() { // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = await KeywordPlanAdGroupServiceClient.CreateAsync(); // Initialize request argument(s) KeywordPlanAdGroupName resourceName = KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"); // Make the request KeywordPlanAdGroup response = await keywordPlanAdGroupServiceClient.GetKeywordPlanAdGroupAsync(resourceName); }
/// <summary>Snippet for GetKeywordPlanAdGroupAsync</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 GetKeywordPlanAdGroupAsync() { // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = await KeywordPlanAdGroupServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/keywordPlanAdGroups/[KEYWORD_PLAN_AD_GROUP_ID]"; // Make the request KeywordPlanAdGroup response = await keywordPlanAdGroupServiceClient.GetKeywordPlanAdGroupAsync(resourceName); }
/// <summary>Snippet for GetKeywordPlanAdGroup</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetKeywordPlanAdGroupRequestObject() { // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = KeywordPlanAdGroupServiceClient.Create(); // Initialize request argument(s) GetKeywordPlanAdGroupRequest request = new GetKeywordPlanAdGroupRequest { ResourceNameAsKeywordPlanAdGroupName = KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"), }; // Make the request KeywordPlanAdGroup response = keywordPlanAdGroupServiceClient.GetKeywordPlanAdGroup(request); }
/// <summary>Snippet for MutateKeywordPlanAdGroups</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateKeywordPlanAdGroups() { // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = KeywordPlanAdGroupServiceClient.Create(); // Initialize request argument(s) string customerId = ""; IEnumerable <KeywordPlanAdGroupOperation> operations = new KeywordPlanAdGroupOperation[] { new KeywordPlanAdGroupOperation(), }; // Make the request MutateKeywordPlanAdGroupsResponse response = keywordPlanAdGroupServiceClient.MutateKeywordPlanAdGroups(customerId, operations); }
/// <summary>Snippet for GetKeywordPlanAdGroupAsync</summary> public async Task GetKeywordPlanAdGroupAsync() { // Snippet: GetKeywordPlanAdGroupAsync(string, CallSettings) // Additional: GetKeywordPlanAdGroupAsync(string, CancellationToken) // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = await KeywordPlanAdGroupServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/keywordPlanAdGroups/[KEYWORD_PLAN_AD_GROUP_ID]"; // Make the request KeywordPlanAdGroup response = await keywordPlanAdGroupServiceClient.GetKeywordPlanAdGroupAsync(resourceName); // End snippet }
/// <summary>Snippet for GetKeywordPlanAdGroupAsync</summary> public async Task GetKeywordPlanAdGroupResourceNamesAsync() { // Snippet: GetKeywordPlanAdGroupAsync(KeywordPlanAdGroupName, CallSettings) // Additional: GetKeywordPlanAdGroupAsync(KeywordPlanAdGroupName, CancellationToken) // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = await KeywordPlanAdGroupServiceClient.CreateAsync(); // Initialize request argument(s) KeywordPlanAdGroupName resourceName = KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER_ID]", "[KEYWORD_PLAN_AD_GROUP_ID]"); // Make the request KeywordPlanAdGroup response = await keywordPlanAdGroupServiceClient.GetKeywordPlanAdGroupAsync(resourceName); // End snippet }
/// <summary>Snippet for MutateKeywordPlanAdGroups</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateKeywordPlanAdGroupsRequestObject() { // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = KeywordPlanAdGroupServiceClient.Create(); // Initialize request argument(s) MutateKeywordPlanAdGroupsRequest request = new MutateKeywordPlanAdGroupsRequest { CustomerId = "", Operations = { new KeywordPlanAdGroupOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateKeywordPlanAdGroupsResponse response = keywordPlanAdGroupServiceClient.MutateKeywordPlanAdGroups(request); }
/// <summary>Snippet for MutateKeywordPlanAdGroupsAsync</summary> public async Task MutateKeywordPlanAdGroupsAsync() { // Snippet: MutateKeywordPlanAdGroupsAsync(string, IEnumerable<KeywordPlanAdGroupOperation>, CallSettings) // Additional: MutateKeywordPlanAdGroupsAsync(string, IEnumerable<KeywordPlanAdGroupOperation>, CancellationToken) // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = await KeywordPlanAdGroupServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; IEnumerable <KeywordPlanAdGroupOperation> operations = new KeywordPlanAdGroupOperation[] { new KeywordPlanAdGroupOperation(), }; // Make the request MutateKeywordPlanAdGroupsResponse response = await keywordPlanAdGroupServiceClient.MutateKeywordPlanAdGroupsAsync(customerId, operations); // End snippet }
/// <summary>Snippet for MutateKeywordPlanAdGroupsAsync</summary> public async Task MutateKeywordPlanAdGroupsRequestObjectAsync() { // Snippet: MutateKeywordPlanAdGroupsAsync(MutateKeywordPlanAdGroupsRequest, CallSettings) // Additional: MutateKeywordPlanAdGroupsAsync(MutateKeywordPlanAdGroupsRequest, CancellationToken) // Create client KeywordPlanAdGroupServiceClient keywordPlanAdGroupServiceClient = await KeywordPlanAdGroupServiceClient.CreateAsync(); // Initialize request argument(s) MutateKeywordPlanAdGroupsRequest request = new MutateKeywordPlanAdGroupsRequest { CustomerId = "", Operations = { new KeywordPlanAdGroupOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateKeywordPlanAdGroupsResponse response = await keywordPlanAdGroupServiceClient.MutateKeywordPlanAdGroupsAsync(request); // End snippet }