GAQL query - get campaigns with advertising_channel_sub_type not set

322 views
Skip to first unread message

Ales Sturala

unread,
Jan 28, 2021, 7:10:53 AM1/28/21
to AdWords API and Google Ads API Forum
Hello,

I am trying to make a GAQL query for campaigns of specific advertising channel type and excluding all campaigns where advertising channel type is set.


While this query returns many campaigns where majority doesn't have advertising channel subtype set:

SELECT
metrics.clicks, campaign.advertising_channel_type, campaign.advertising_channel_sub_type
FROM campaign


Then this query doesn't return any campaigns at all. Expected is that it will return all those campaigns of SEARCH and SHOPPING without advertising channel subtype set:

SELECT
metrics.clicks, campaign.advertising_channel_type, campaign.advertising_channel_sub_type
FROM campaign
WHERE campaign.advertising_channel_sub_type NOT IN (
  'SEARCH_EXPRESS',
  'DISPLAY_EXPRESS',  
  'DISPLAY_SMART_CAMPAIGN',
  'SHOPPING_SMART_ADS'
   /* and all the other advertising sub channel types */
)

Is there a way to query for all campaigns where advertising_channel_sub_type is NULL/EMPTY/NOT SET?


Best,
 Ales

Google Ads API Forum Advisor Prod

unread,
Jan 29, 2021, 2:37:34 AM1/29/21
to al...@trueclicks.com, adwor...@googlegroups.com
Hi Ales,

You can refer to our Query grammar guide to know more on what operators you can use, depending on your reporting requirement.

Regarding your question about the advertising_channel_sub_type if the value is not set, you can try and use the IS NULL operator. I hope this helps.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2BbfhK:ref

Ales Sturala

unread,
Jan 29, 2021, 5:54:18 AM1/29/21
to AdWords API and Google Ads API Forum
Hi Peter,

I read the documentation already before and tested different options with no luck. Query grammar only gives you syntactical options but not semantical so it doesn't say which operators are valid for which fields. I tested IS NULL and couple of other approaches but I had no luck getting only rows where advertising_channel_sub_type is not set.

Also I guess that the NOT IN operator shouldn't implicitly exclude NULL values.

If you would manage to do such a query please let me know. For now we will load all the data from the API and do additional filtering in the backend.


Best,
 Ales

Ales Sturala

unread,
Mar 4, 2021, 7:45:11 AM3/4/21
to AdWords API and Google Ads API Forum
Hi Peter,

Do you have by any chance any update on this topic?


Best, 
 Ales

Google Ads API Forum Advisor Prod

unread,
Mar 5, 2021, 12:24:18 AM3/5/21
to al...@trueclicks.com, adwor...@googlegroups.com
Hi Ales,

Thank you for returning back to us.

There is a value in campaign.advertising_channel_sub_type field field which will be returned when advertising channel sub-type is not specified in a campaign, and this value is UNSPECIFIED. With this, I would suggest filtering the said field with UNSPECIFIED value and by using != (not equal) operation and try to generate report again.

Let me know how it goes after trying the provided suggestion.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


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