Posts under category Google

Since Google is going to have a new API after April, some of existing reports/metrics will be unavailable such as

  1. Missing the whole CRITERIA_PERFORMANCE_REPORT
  2. Missing CriteriaId in CLICK_PERFORMANCE_REPORT

However, some of the metrics are quite import for existing reports... May I ask if there is any way to get the old metrics in the new Google API?

I have created my service account, following the Google documentation as best I can. I created a JSON Key File and have used it successfully to create and refresh my access token, but when I try to call the Google Ads API using that access token I get a 401 with the message "User in the cookie is not a valid Ads user."

I am using a PHP cURL request, not the Google Client library.

My suspicion is that I have something set up incorrectly somewhere between the Master Ad account, the service account and the project in the Google Cloud Console, but I am finding the documentation confusing and unhelpful.

I submitted a question to the Google Ads API google group, and the support person said that my setup looked OK, but also admitted that he cannot see all of it from his end.

I have created the following pieces of the puzzle:
Google Ads Master Account
Developer Token
Project in Google Cloud Console
Service Account in Project
Private Key for Service Account
Set email of Master Ads Account to role of Owner of Service Account
Enabled Domain-Wide Delegation for the Service Account with scope "https://www.googleapis.com/auth/adwords"
Requested and received Access Token with the private key in the JSON file

Please let me know what extra details I should provide to get my issue resolved. Thanks in advance.

We are in process of migrating code from Ad Words to Google Ads. First step from this is to get all customers which are assigned to for logged in user. For this Ad Words has an API called "CustomerServiceInterface.getCustomers" method which returns all customers at once.

But in Google Ads, there doesn't seem to be similar method. All we could find was get-account-hierarchy

Looking at the code, it is getting all child accounts by recursion method.

This has a major performance bottleneck as it has to iterate over all accessible customers first and then recursively over all manager and their children.

Question for the experts here - is there any efficient way I can get all customers at once? At least can we get all managers accessible to logged in user?

We did find a relevant article - https://groups.google.com/g/adwords-api/c/UHWxe7ag7zI. But that seems to talk about API quota rather than performance.

I am using .net client library to access google ads API using C# .NET.

I have configured 'Installed App' account in following order:

  1. Configured Manager Account for Developer Token.
  2. Created oAuth credentials using Manager Account and developer console
  3. Created test manager account (test Account isn't linked to Ads account).
  4. Enabled Ads API from Ads Console.
  5. Placed configuration in App.Config

App.Config configuration:

    <add key = 'OAuth2Mode' value = 'APPLICATION' />     <add key = 'OAuth2ClientId' value = 'OAUTH-CLIENT-ID' />     <add key = 'OAuth2ClientSecret' value = 'SECRET' />     <add key = 'OAuth2RefreshToken' value = 'REFRESH-TOKEN' />     <add key="DeveloperToken" value="DEV-TOKEN" /> 

I got refresh token from adwords client-library OAuthTokenGenerator.exe using Test account.

Here is my code to access Ads API:

 public static void GetCampaigns(GoogleAdsClient client, long customerId)  {       client.Config.LinkedCustomerId = customerId.ToString();       GoogleAdsServiceClient googleAdsService = client.GetService(Services.V9.GoogleAdsService);       string query = @"SELECT                             campaign.id,                             campaign.name,                             campaign.network_settings.target_content_network                         FROM campaign                         ORDER BY campaign.id";             try             {                 // Issue a search request.                 googleAdsService.SearchStream(customerId.ToString(), query,                     delegate (SearchGoogleAdsStreamResponse resp)                     {                         foreach (GoogleAdsRow googleAdsRow in resp.Results)                         {                             Console.WriteLine("Campaign with ID {0} and name '{1}' was found.",                                 googleAdsRow.Campaign.Id, googleAdsRow.Campaign.Name);                         }                     }                 );             }             catch (GoogleAdsException e)             {                 Console.WriteLine("Failure:");                 Console.WriteLine($"Message: {e.Message}");                 Console.WriteLine($"Failure: {e.Failure}");                 Console.WriteLine($"Request ID: {e.RequestId}");                 throw;             }         } 

However i am receiving this exception on calling API:

 Status(StatusCode="Unauthenticated", Detail="Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1643028386.159000000","description":"Error received from peer ipv4:142.250.181.106:443","file":"..\..\..\src\core\lib\surface\call.cc","file_line":1070,"grpc_message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}") 

can anyone guide me what am i missing in this configuration?

I have always referred to Adwords API. now that google is about to deprecate it i'm trying to migrate to google ads api.
I am using keywords_performance_report
I have been looking at the mapping google is providing:
LabelIds- Select label.resource_name from the resource ad_group_label
I'm using keyword_view resource for all the other data.
how can I combine these 2 resources in one query?