Fetch report with all values of AdGroupStatus and CampaignStatus

36 views
Skip to first unread message

Pavel G

unread,
Apr 28, 2020, 6:50:30 AM4/28/20
to AdWords API and Google Ads API Forum
Hi,

We need to fetch report that contains the fields we need, but with all statuses of AdGroupStatus and CampaignStatus fields. 

In this forum I found suggestions that I need to add the following code to my request:
WHERE AdGroupStatus IN ['ENABLED','PAUSED','REMOVED'] AND CampaignStatus IN ['ENABLED','PAUSED','REMOVED']

But after some tests I got results with CampaignStatus == 'REMOVED'.without this condition. The following curls return the same results with 5 rows for me (their CampaignStatus is 'REMOVED'):

curl --http1.1 \
   
--header "Authorization : Bearer {token}" \
   
--header "developerToken : {developerToken}" \
   
--header "includeZeroImpressions: false" \
   
--header "clientCustomerId : {clientCustomerId}" \
   
--data "__rdquery=SELECT Impressions, AdNetworkType1, Conversions, EffectiveFinalUrl, CampaignId, Device, CampaignName, Clicks, VideoViews, Cost, Date, InteractionTypes, AdGroupStatus FROM FINAL_URL_REPORT WHERE CampaignId={CampaignId} AND CampaignStatus IN ['ENABLED','PAUSED','REMOVED'] DURING+20190708,20190708&__fmt=CSV" \

curl --http1.1 \
    --header "Authorization : Bearer {token}" \
    
--header "developerToken : {developerToken}" \
    
--header "includeZeroImpressions: false" \
    
--header "clientCustomerId : {clientCustomerId}" \
    
--data "__rdquery=SELECT Impressions, AdNetworkType1, Conversions, EffectiveFinalUrl, CampaignId, Device, CampaignName, Clicks, VideoViews, Cost, Date, InteractionTypes, AdGroupStatus FROM FINAL_URL_REPORT WHERE CampaignId={CampaignId} DURING+20190708,20190708&__fmt=CSV" \
    https
://adwords.google.com/api/adwords/reportdownload/v201809

The only difference is that the second curl have no CampaignStatus IN ['ENABLED','PAUSED','REMOVED'] condition.
My question is it mandatory to have this WHERE condition if we want to fetch report with all statuses of AdGroupStatus and CampaignStatus, or may be it is mandatory for only some types of reports? Do you have any information about this in you documentation?

Thanks in advance.

Zweitze

unread,
Apr 28, 2020, 11:06:35 AM4/28/20
to AdWords API and Google Ads API Forum
If you're talking about AdWords API: don't assume anything.

I've been developing for AdWords API well over ten years, in those years the default behavior (= not including such conditions) changed at least seven times. In other words, if you didn't include a predicate on status, sometimes you got removed objects, sometimes not. Sometimes those changes in behavior were announced, sometimes not. Every time Google's response was that the new situation was the right situation.

You ask if it's mandatory to include such conditions. Of course not, but prepare yourself for surprises every now and then.
Personally I started to include conditions for every status field in every report type long time ago. I never regretted that decision.

If your question is on Google Ads API, I don't know if Google will be creating the same mess. If you don't like to take risks there, consider to include the WHERE conditions anyway. Don't forget that Google Ads API expects every one of those fields to be present in the select list as well.

Google Ads API Forum Advisor Prod

unread,
Apr 28, 2020, 1:49:17 PM4/28/20
to pa...@fivetran.com, adwor...@googlegroups.com
Hi Pavel,

Thank you for reaching out. REMOVED campaigns and ad groups should show by default in all reports unless you specifically filter them out. As Zweitze noted, my team has come across some inconsistencies with this and we are in the process of investigating this issue. Though the filter is not necessary, it can't hurt to ensure that your report returns what you expect.

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5001UaScTP:ref
Reply all
Reply to author
Forward
0 new messages