Basic MCC budget tracker script - tweak

104 views
Skip to first unread message

Tom Haynes

unread,
Jul 26, 2022, 10:55:54 AM7/26/22
to Google Ads Scripts Forum
Hi,

I found this useful, basic MCC Budget Tracker script online (see attached - https://acuto.io/blog/a-basic-mcc-budget-tracker-google-ads-scripts-series/). I was hoping there might be a way to replace getting the number of campaigns, to getting the campaign names instead in rows?

As well as this, a way to get the date range to be month to date instead?

Thanks,
Tom    
Basic MCC Account Tracker Script.txt

Google Ads Scripts Forum Advisor

unread,
Jul 27, 2022, 3:44:57 AM7/27/22
to adwords...@googlegroups.com

Hi Tom,

 

Thank you for reaching out to us. This is Yasmin from the Google Ads Scripts team.

 

I would recommend you reach out to the script provider for further insights as I'm afraid we are unable to make modifications to third party scripts. On that note, you may refer to this link from our documentation in order to get a campaign by name. As for the date range, I do believe that the only available options are specified within the script.

 

Regards,

 

Google Logo
Yasmin Gabrielle
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2d1brQ:ref

Nils Rooijmans

unread,
Jul 28, 2022, 3:23:17 AM7/28/22
to Google Ads Scripts Forum


you would need to expand the script to get and report campaign level stats.

You can do so by adding the following lines of code directly after the line that says ' data.push([account.getCustomerId(), numCampaigns, cost, clicks, conversions, impressions]);
So, between line 41 and 42 , add

var campaignIterator = AdsApp.campaigns().withCondition('Status != REMOVED').get();
while (campaignIterator.hasNext()) {
    var campaign = campaignIterator.next();
    var campaignName = campaign.getName();
    var cost = campaign.getStatsFor(config.dateRange).getCost();
    var clicks = campaign.getStatsFor(config.dateRange).getClicks();
    var conversions = campaign.getStatsFor(config.dateRange).getConversions();
    var impressions = campaign.getStatsFor(config.dateRange).getImpressions();
    data.push([account.getCustomerId(), campaignName, cost, clicks, conversions, impressions]);
}



Note, this will only report SEARCH and DISPLAY campaigns. For campaigns with a different type you need to create a script that queries the report API.

Hope this helps,

Nils Rooijmans
https://nilsrooijmans.com
See my Google Ads Scripts FAQ to avoid the same mistakes I made: https://nilsrooijmans.com/google-ads-scripts-faq/
Reply all
Reply to author
Forward
0 new messages