Posts under category google-ads-api

I would like to daily monitor the optimization score of Google Ads. It is the metric shown below on the printscreen.

Does anyone know a method ( via API, Supermetrics, or other script ) to return this value to a Google Spreadsheet? I've been searching on Google Ads API but did not find anything so far, and I am curious if anyone got a solution for this.

I am working with the GEO_PERFORMANCE_REPORT in order to fetch data related to the account locations. More specifically, the report I am working with is the User Locations Report, which can be found directly on the AdWords UI.

But I found out that there are some notorious differences for the data obtained via the AdWords API and the data shown via the AdWords UI, and the issues happen specifically with the aforementioned report, but also with the “Geographic Report”. I have applied the corresponding filters for the query, just as it's stated on the official documentation (1 and 2), but even with that, the data differs a lot between both sources.

The query I am constructing ends up being the following one:

Google\AdsApi\AdWords\Query\v201809\ReportQuery {#7426   -awqlString: "SELECT CampaignId, LocationType, Clicks, Impressions, CityCriteriaId, MostSpecificCriteriaId, CountryCriteriaId FROM GEO_PERFORMANCE_REPORT WHERE LocationType = 'LOCATION_OF_PRESENCE' AND IsTargetingLocation IN ['TRUE', 'FALSE'] DURING 20200401,20200430" } 

And the results I am getting (after sorting them by the Clicks metric) are the following: https://www.dropbox.com/s/6xpme91ig6wu1oy/Screenshot%202020-05-13%2018.18.43.png?dl=0. But on the AdWords UI I get the following: https://www.dropbox.com/s/cgtyglbs87lkb1p/Screenshot%202020-05-13%2018.20.20.png?dl=0.

I can see that there are similar issues open at the AdWords forum (1 and 2), but none of them seem fully solved.

Finally, based in the https://developers.google.com/adwords/api/docs/appendix/geotargeting documentation and in some other tests I did by using the MostSpecificCriteriaId, I have the theory that this could be an issue with the zipcodes mapping on the API.

Do you know what is the reason of the discrepancy for the click counts (and also for the impression counts) between both sources of these report?. Help will be appreciated.

I have managed to generate developer_token, oauth client_id, oauth client_secret and oauth refresh_token, using the steps described here, and I've set their values in the googleads.yaml. I did not set any value to client_customer_id, because of an issue in the UI (opened a thread with google adwords product team). However, when I reached this step, I got AuthenticationError.OAUTH_TOKEN_INVALID. I'm using python 3.7, googleads 23.0.1 and code samples from here.

The code I'm running:

client = adwords.AdWordsClient.LoadFromStorage(f'{os.getcwd()}/oauth/googleads.test.yaml') # Initialize appropriate service. campaign_service = client.GetService('CampaignService', version='v201809') # Construct selector and get all campaigns. offset = 0 selector = {     'fields': ['Id', 'Name', 'Status'],     'paging': {         'startIndex': str(offset),         'numberResults': str(PAGE_SIZE)     } } more_pages = True while more_pages:     page = campaign_service.get(selector) # this is the line which raises the exception 

Any suggestions?

Highly appreciate your help, Tal

When I use the generate_refresh_token.py :

pipenv run python authentication/generate_refresh_token.py --client_id xxxxx --client_secret yyyy Log into the Google Account you use to access your AdWords account and go to the following URL: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=xxxx&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadwords&state=xxxxx&prompt=consent&access_type=offline 

When I follow the link I get a 403 "org_internal: This client is restricted to users within its organization", I'm using a google account that has the name.surname@domain.com that matches the organization's domain and I have been invited to the project.

What else is need for my google account to be considered part of the "organization"?

I'd like to to create a test adwords client account so I can use it for adwords API calls with a pending developer token.

I have followed the steps in the doc in this link and successfully created a test manager account (with the red label) using the Google Ads UI.

As required, I did that with a different google id than the one I used for the production manager account. Then it says in the doc "While logged in to Google Ads as your test manager account, any client accounts you create will automatically be test accounts." But for me those clients accounts were created as production. No red label, and requesting for budget. Any idea what am I doing wrong, or an alternative way to create a client test account?

Appreciate your help, Tal