Unfortunately, only search and display campaigns are supported in the standard campaign selector.
For other campaign types you should use the specific selectors (such as ShoppingCampaignSelector for shopping , VideoCampaignSelector for video campaigns, and PerformanceMaxCampaignSelector for Performance Max campaigns).
Aside from those, the following campaigns are not yet supported in any campaign selector within Google Ads scripts:
-
- discovery
- local campaigns
- Demand Gen
For now, you can only retrieve data for these campaign types via AdsApp.search / report.
Here’s an example code snippet on how to use GAQL to get the number of clicks for your Discovery / Demand Gen campaigns
function main() { var nrOfCampaigns = 0; var query = "SELECT " + "campaign.name, campaign.advertising_channel_type, metrics.clicks " + "FROM campaign "+ "WHERE campaign.status = ENABLED AND campaign.advertising_channel_type = DISCOVERY AND segments.date DURING THIS_MONTH"; try { var result = AdsApp.search(query); while (result.hasNext()) { var row = result.next(); Logger.log("CampaignName: '"+row.campaign.name+"' , Clicks: "+row.metrics.clicks); nrOfCampaigns++; } } catch (e) { Logger.log("### ERROR: "+e); } Logger.log("\nNumber of enabled PMax campaigns: "+nrOfCampaigns); }
—
Interested in running more scripts?
Join thousands of PPC geeks who already have access:
If the button above isn’t working for you, you can sign up here to get access.