Check spend on Discovery campaigns?

737 views
Skip to first unread message

Christopher Larkin

unread,
Oct 10, 2019, 5:47:23 PM10/10/19
to Google Ads Scripts Forum
Hi -

Is there a programmatic method to access Discovery campaigns' stats like we do with search, display and video?

I have a script that checks groups of campaigns against budgets set for those groups (and the grouping is done by a partial name match) every hour, and when the budgets have been exceeded, the campaigns are stopped. 

I just discovered that $103 was missing from a total, and that was due to a new Discovery campaign.

Please advise -
Christopher 

Google Ads Scripts Forum Advisor

unread,
Oct 11, 2019, 1:46:13 AM10/11/19
to adwords...@googlegroups.com
Hi Christopher,

My apologies as the discovery campaign type is currently not supported in any Google Ads scripts methods and in any report types so it is not possible also to get the statistic of this type of campaign.

Please continue to follow our blog to receive upcoming updates with this type of campaign.

Regards,
Ejay
Google Ads Scripts Team

ref:_00D1U1174p._5001UKMweu:ref

Sigurd

unread,
Oct 11, 2019, 3:02:53 AM10/11/19
to Google Ads Scripts Forum
Hi Ejay,

Just to clarify: 

* Will the cost of discovery campaigns not be part of costs in cross account reports such as the account performance report? https://developers.google.com/adwords/api/docs/appendix/reports/account-performance-report#cost

I would have guessed that a quick workaround to Christopher's problem would be e.g. to let budget names for discovery campaigns be equal to campaign names and then just filter on budget names instead of campaign names using the budget performance report https://developers.google.com/adwords/api/docs/appendix/reports/budget-performance-report

Christopher Larkin

unread,
Oct 11, 2019, 3:31:08 AM10/11/19
to Google Ads Scripts Forum

Sigurd

Thanks for your suggestion. I just tested via AWQL and this solves my problem. 

Interestingly, I built a couple of different "spend check" functions, with one using getStats and the other doing a query of reports, and now I can see the benefits in using AWQL to handle this.

With AWQL, we do get the matches by name, exactly as desired!! 

Ejay, thanks for always answering quickly, and Sigurd, thank you for the idea that was easy to test and even easier to implement since I already had the function in my MCC_Library. 

BTW -- where is the best place for me to share my completed function libraries? Should I just upload to Github and share links/descriptions in this forum? I want to give back to the community since it's given me so much!

Thanks again - 
Christopher

Google Ads Scripts Forum Advisor

unread,
Oct 11, 2019, 5:36:39 AM10/11/19
to adwords...@googlegroups.com
Hi Sigurd,

I am afraid that this type of campaign is currently not supported in any Google Ads report types. However, for the workaround that you provided, thank you for sharing your idea.

Hi Christopher,

I am happy to know that your script is now working. Let me know if you have further questions/concerns. Also, it is your preference to wherever you want to upload the created script.

Sigurd

unread,
Oct 11, 2019, 11:32:09 AM10/11/19
to Google Ads Scripts Forum
@ Christopher: you're welcome and great it worked :)

@ adsscriptsforumadvisor: your somewhat cryptic answer made me wanna test it myself ;)

So, it is possible to get e.g. cost data for discovery campaigns and use this to send an alert or whatever.

However, it doesn't seem to be possible to do stuff directly to Discovery campaigns. Maybe it works through bulk uploads. Otherwise, maybe they be controlled indirectly by manipulating a shared budget, a bid strategy or some targeting

This code fetches stats for discovery campaigns
function main() {
  var campaignName = 'discovery'; // something that identifies all discovery campaigns
  var timePeriod = 'LAST_7_DAYS';
 var report = AdsApp.report(
    'SELECT ' +
    'Cost, CampaignName ' +
    'FROM CAMPAIGN_PERFORMANCE_REPORT ' +
    'WHERE CampaignName CONTAINS_IGNORE_CASE ' + campaignName + ' ' +
    'DURING ' + timePeriod
    );
  var rows = report.rows();
    var campaignNames = [];
    var campaignCosts = [];
 while (rows.hasNext()) {
  var row = rows.next();
  var costS = JSON.stringify(row['Cost']).replace(',','');
  var costD = JSON.parse(costS);
  var costFloat = parseFloat(costD);
    campaignCosts.push(costFloat)
    campaignNames.push(row['CampaignName'])
}
  var summedCampaignCosts = 0;
 for (var key in campaignCosts) {
    summedCampaignCosts += campaignCosts[key];
 }
  Logger.log('Total spend on campaigns with "' + campaignName + '" in the name during the ' + timePeriod.toLowerCase().replace(/_/g,' ') +': ' + summedCampaignCosts.toFixed(2) +
            '\n\nCampaigns:\n\n' + campaignNames.join('\n'));
}

Google Ads Scripts Forum Advisor

unread,
Oct 14, 2019, 3:39:54 AM10/14/19
to adwords...@googlegroups.com

Hi Sigurd,

Thank you for helping the other developers in this forum.

However, the discovery campaign type is currently not supported in the Google Ads scripts and in any report types.

Also, upon checking the provided code, I can see that you are filtering the campaign by its name and not by its campaign type. So, I am assuming that all the campaigns that has ‘discovery’ on its name are discovery campaign type and you can get its information, especially the cost. With this, could you provide the customer ID and the name of the script where you’ve implemented the provided code so I can confirm this with the rest of the team. You can provide the requested information via Reply privately to author option.



Regards,
Ejay
Google Ads Scripts Team



ref:_00D1U1174p._5001UKMweu:ref

Sigurd

unread,
Oct 14, 2019, 4:11:01 AM10/14/19
to Google Ads Scripts Forum
Hi Ejay,

No need to check any further :)
It was just example code to illustrate that it is possible to fetch stats from discovery campaigns through scripts even though the campaign type is not supported.

 #0 couldn't fetch all campaign costs in an account because the costs of discovery campaigns were not included in his script.
Your original answer seems to suggest that this problem cannot be solved because the campaign type is not supported.

cheers
  sigurd

MATTHEW Dworkin

unread,
Feb 7, 2022, 4:30:37 PM2/7/22
to Google Ads Scripts Forum
Hello, 

I just wanted to check in and see if it's still the case that Discovery campaigns are not supported by Google Adscripts methods. 

Thanks,
Matt

Google Ads Scripts Forum Advisor

unread,
Feb 8, 2022, 3:24:59 AM2/8/22
to adwords...@googlegroups.com
Hi Matt,

I'm afraid that this is still not supported on Google Ads Scripts. However, the team is currently updating the Google Ads Scripts which is on beta stage now that will most likely supports a wide range of Entities. You may want to keep an eye on our developer blog for updates regarding this.

Regards,
Google Logo
Teejay Wennie Pimentel
Google Ads Scripts Team
 


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