Posts under category google-ads-api

I recently got my new Macbook Pro and installed 3.8.6 with pyenv and created a virtualenv for my project. When I try to run the tests for this project i get the following error about a module not found by a dependency (abridged). The the files are all there, ad_manager is a file right next to the __init__.py file that is importing it. This was not a problem on my old machine.

echo $PYTHONPATH is empty

python -c 'import sys; print(sys.path)' -> ['', '/Users/derek/.pyenv/versions/3.8.6/lib/python38.zip', '/Users/derek/.pyenv/versions/3.8.6/lib/python3.8', '/Users/derek/.pyenv/versions/3.8.6/lib/python3.8/lib-dynload', '/Users/derek/.pyenv/versions/VIRTUAL_ENV_3.8.6/lib/python3.8/site-packages']

Traceback (most recent call last):   File "/Users/derek/dev/PATH_TO_PROJECT/tests/../src/services/adwords_service.py", line 18, in <module>     from googleads import oauth2, adwords   File "/Users/derek/.pyenv/versions/VIRTUAL_ENV_3.8.6/lib/python3.8/site-packages/googleads/__init__.py", line 17, in <module>     from ad_manager import AdManagerClient ModuleNotFoundError: No module named 'ad_manager' 

I figured out how to create & delete keyword plans, but I couldn't figure out how I can get a list of all my existing keyword plans (resource names / plan ids)?

final long customerId = Long.valueOf("XXXXXXXXXX");     GoogleAdsClient googleAdsClient = new ... KeywordPlanServiceClient client = googleAdsClient.getVersion8().createKeywordPlanServiceClient(); String[] allExistingKeywordPlans = client. ??? 


<dependency>     <groupId>com.google.api-ads</groupId>     <artifactId>google-ads</artifactId>     <version>16.0.0</version> </dependency> 


Further resources: https://developers.google.com/google-ads/api/docs/samples/add-keyword-plan

Any hints on how this can be solved is highly appreciated! Many thanks in advance!

We have a BigQuery data transfer of GoogleAds data. I came to realization, that I probably do not understand what is in the aggregates.

The discrepancy occurs with "Discovery" campaigns. Here is the query:

SELECT     '1. AdStats' as table,     SUM(Clicks)       AS clicks,     SUM(Cost)/1000000 AS cost,     SUM(Impressions)  AS impressions FROM `project.dataset.p_AdStats_*` WHERE Date = @date AND CampaignId = @campaign     UNION ALL SELECT     '2. AdBasicStats' as table,     SUM(Clicks)       AS clicks,     SUM(Cost)/1000000 AS cost,     SUM(Impressions)  AS impressions FROM `project.dataset.p_AdBasicStats_*` WHERE Date = @date AND CampaignId = @campaign     UNION ALL SELECT     '3. AdGroupStats' as table,     SUM(Clicks)       AS clicks,     SUM(Cost)/1000000 AS cost,     SUM(Impressions)  AS impressions FROM `project.dataset.p_AdGroupStats_*` WHERE Date = @date AND CampaignId = @campaign     UNION ALL SELECT     '4. AdGroupBasicStats' as table,     SUM(Clicks)       AS clicks,     SUM(Cost)/1000000 AS cost,     SUM(Impressions)  AS impressions FROM `project.dataset.p_AdGroupBasicStats_*` WHERE Date = @date AND CampaignId = @campaign ORDER BY 1 

The results come in:

table                clicks cost       impressions 1. AdStats           74     2.906935   15582 2. AdBasicStats      74     345.444868 15582 3. AdGroupStats      78     15.786935  15802 4. AdGroupBasicStats 78     358.324868 15802 

The GoogleAds UI shows 78 clicks, €358.32 and 15802 impressions for campaign report. It matches AdGroupBasicStats.

But I need more.. I need math to hold - AdBasicStats should have the same data, but in more granular detail (on Ad level). But it does not. Also, this is just killing me:

345.444868 + 15.786935 - 2.906935 = 358.324868 ?!?! 

What the actual f...? I've tested multiple days, different campaigns. The math is there. Can someone explain me what does those aggregates have? Point me to any resource describing the data in the tables, please.

Couple of notes:

  1. I suspect that data from AdStats is already in both AdBasicStats and AdGroupStats. Thus the minus in equation. But what does that data stand for? How can I identify such data in other aggregates?
  2. Backfill is not the culprit, I've refreshed data multiple times in historical periods.
  3. Interestingly enough, this behaviour only occurs with "Discovery" campaigns. Other types, e.g. "Display", seems not to have this discrepancy.
  4. I've tried to contact Google Ads support, but they directed me to the GCP support instead, which we don't have available for our account.

I am migrating our API ingestion from googleads to google-ads in python and I noticed that the campaign resource only returns entities that have status "ENABLED". In the googleads version, it returns all entities by default when you request for it.

I tried modifying the GAQL to include filtering like where campaign.status != 'ENABLED' and I get no results back from the API.

Is there a way to get entities with all status like "PAUSED", "REMOVED" etc? Also, is there a place to run the GAQL in the web UI? (They have the GAQL validator but it doesn't let me run it)