Google AdWords API returns AdGroups not connected to clienctCustomerId account

71 views
Skip to first unread message

Łukasz Stankiewicz

unread,
Jul 8, 2019, 9:39:11 AM7/8/19
to AdWords API and Google Ads API Forum
Hello,
is Google Ads API is reverted to beta program I am rewriting implementation to AdWords API and encouraged strange problem when requestion AdGroups API return AdGroups with campaignId not belonging to the Account.

AdGroups Request:
'<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:tns="https://adwords.google.com/api/adwords/cm/v201809" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"><soap:Header><ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809" xmlns="https://adwords.google.com/api/adwords/cm/v201809"><ns1:developerToken>***</ns1:developerToken><ns1:userAgent>***</ns1:userAgent><ns1:validateOnly>false</ns1:validateOnly><ns1:clientCustomerId>6110478927</ns1:clientCustomerId></ns1:RequestHeader></soap:Header><soap:Body><get xmlns="https://adwords.google.com/api/adwords/cm/v201809"><serviceSelector><fields>Id</fields><fields>Name</fields><fields>Status</fields><fields>AdGroupType</fields><fields>CampaignId</fields><paging><numberResults>100</numberResults></paging></serviceSelector></get></soap:Body></soap:Envelope>

in response I get for ex.

            {
                "id": "39792076497",
                "campaignId": "803601490",
                "name": "Ad Group #1",
                "status": "ENABLED",
                "adGroupType": "SEARCH_STANDARD"
            },
            {
                "id": "41012012366",
                "campaignId": "820121402",
                "name": "Ad Group #1",
                "status": "ENABLED",
                "adGroupType": "SEARCH_STANDARD"
            },

And I query for this campaign ids:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:tns="https://adwords.google.com/api/adwords/cm/v201809" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"><soap:Header><ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809" xmlns="https://adwords.google.com/api/adwords/cm/v201809"><ns1:developerToken>***</ns1:developerToken><ns1:userAgent>***</ns1:userAgent><ns1:validateOnly>false</ns1:validateOnly><ns1:clientCustomerId>6110478927</ns1:clientCustomerId></ns1:RequestHeader></soap:Header><soap:Body><get xmlns="https://adwords.google.com/api/adwords/cm/v201809"><serviceSelector><fields>Id</fields><fields>Name</fields><fields>Status</fields><fields>ServingStatus</fields><fields>AdvertisingChannelType</fields><predicates><field>Id</field><operator>IN</operator><values>820121402</values><values>803601490</values></predicates><paging><numberResults>100</numberResults></paging></serviceSelector></get></soap:Body></soap:Envelope>

and the response is empty

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809"><requestId>00058d2b8301be4a0ae9c105440e7d04</requestId><serviceName>CampaignService</serviceName><methodName>get</methodName><operations>1</operations><responseTime>186</responseTime></ResponseHeader></soap:Header><soap:Body><getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201809"><rval><totalNumEntries>0</totalNumEntries><Page.Type>CampaignPage</Page.Type></rval></getResponse></soap:Body></soap:Envelope>

I do not also see this campaign ids within Google Ads Page

What it can be caused by?

Thanks 

Łukasz Stankiewicz

unread,
Jul 8, 2019, 9:55:16 AM7/8/19
to AdWords API and Google Ads API Forum
As the further investigation goes these campaigns have status REMOVED but AdGroups still have status ENABLED so I cannot filter them out.

Google Ads API Forum Advisor Prod

unread,
Jul 8, 2019, 4:35:53 PM7/8/19
to adwor...@googlegroups.com, lukas.st...@gmail.com
Hello łukasz, 

I know this whole decision to moving to Google Ads API Beta is a lot to take in, and we really appreciate that all of you stay on top of our communication channels. You're right. You will not be able to filter removed campaigns using the AdGroupService. You may use the AdGroup Performance Report where you can filter the campaigns and ad group based on the status (AdGroupStatus and CampaignStatus). 

Let us know if you have any questions. 

Thanks,
Bharani, Google Ads API Team 

ref:_00D1U1174p._5001UCbaJL:ref

Łukasz Stankiewicz

unread,
Jul 9, 2019, 3:04:37 AM7/9/19
to AdWords API and Google Ads API Forum
Hello,
I do not think we understood each other. Let me explain it again.

1. When I query for Campaigns without any predicates query response is always Campaigns without Campaign with Status REMOVED. That is not normal behavior for me as you can see in documentation (https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService.Campaign) the Status field has the description "This field can be filtered on" but if you used predicates to filter the only REMOVED campaigns you will get removed Campaigns. With no predicates, you get only PAUSED and ENABLED. Maybe its be design no info in the documentation about that.

2. For AdGroups there also is a field called Status but AdGroups belonging to REMOVED Campaigns have the status ENABLED not REMOVED so I cannot filter them out by Status field as the documentation says "This field can be filtered on".
As I understand the AdGroup will have the same value for Status in Reporting API also. 

The question is why AdGroups from REMOVED Campaigns have ENABLED status and is there any possibility to do not query them? Is there case same for Ads within removed Campaign they also will not have REMOVED status?

Thank you

Łukasz Stankiewicz

unread,
Jul 9, 2019, 5:47:23 AM7/9/19
to AdWords API and Google Ads API Forum
Another thing is that as I can see there is no pagination possibility in Reporting API?

Google Ads API Forum Advisor Prod

unread,
Jul 10, 2019, 11:39:40 AM7/10/19
to lukas.st...@gmail.com, adwor...@googlegroups.com
Hello łukasz, 

That is correct. To pull the removed entities you will need to explicitly query for the REMOVED campaigns. As for your concern, status changes at the campaign level will affect the statuses of the ad groups, ads, and criteria within it. A status change at the ad group level will affect the ads and keywords contained within it, and so on. If an criteria belongs to a removed campaign, it's effective status is removed as well even though they display as enabled.

Google Ads Query Language supports paging by specifying page_size in your request. You will be add paging through the results by following this guide

Let me know if you have any questions.

Regards,
Reply all
Reply to author
Forward
0 new messages