Track Google Ads Spend Script
Even if you’re the best PPC account manager in the world, the search market is a rollercoaster of ups and downs. Within the space of an hour, there could be a surge in spend or a slump in search volume, and if you aren’t aware of these changes, you might miss out. This script will make you the Big Brother of Google Ads: there’ll be nothing that slips past your vigilant gaze. In a good way.
How does the script work?
The script emails you every hour with the current cost of your account. If there’s a sudden surge in spend or slump in searches, you’ll know about it and be able to act in time. It can also give impressions and clicks, and (if you don’t have any lags for them) conversion data.
How do I use it?
To set up the script, go to your Google Ads account, then choose Bulk Operations and go into Scripts. Then, click the red “+ SCRIPT” button and paste in the code below.
There are a couple of settings for you to change (unless you want your emails to go to firstname.lastname@example.org):
- If you don’t want to look at metrics from all campaigns (Say you’re not concerned about Display campaigns), you can list phrases contained in campaign names which you would like to exclude in campaignNameDoesNotContain. For example, [“Display”] or [“Display”, “Shopping”]. Or you can enter phrases contained in campaign names which you would like to include in campaignNameContains. Leave these both as  to look at your whole account.
- The important one is email: Change this to your email address or a list of email addresses.
- Google Ads Scripts will send emails even when you’re just doing a Preview run. So you might want to just use your email address here when you first set up the Script, and then add in other people once you’re sure it’s working.
- metricsToReport says which metrics you want to, uh, report. If you’d like to keep track of clicks and impressions, as well as cost, then put this down as [“Cost”, “Clicks”, “Impressions”]. If you only care about cost, then it’s just [“Cost”].
- Your options for this are “Impressions,” “Clicks,” “Cost,” “ConvertedClicks,” “Conversions” and “ConversionValue.”
- Note that there may be a delay for conversion data (even longer than for Google Ads data in general). If you get conversions from Analytics, you could be waiting an entire day. So be careful if you are reporting these.
- currencySymbol will be stuck in front of any currency values (i.e., costs and conversion values) in the email.
- thousandsSeparator and decimalMark are used to format numbers; so if thousandsSeparator is “,” and decimalMark is “.” then numbers will appear like “1,234.56.” If thousandsSeparator is “.” and decimalMark is “,” then numbers will appear like “1.234,56.”
Authorize and Preview the script to make sure there are no errors.
You should get an email that looks something like this:
When it’s all working, set up an hourly schedule.
A few things to note:
- Any emails the script sends will appear to be from you.
- What counts as “today” depends on the time zone of your Google Ads account. The time reported in the email is also based on the account’s time zone.
- There’s a lag of about 20 minutes before Google Ads gets data. For example, if the script runs at 10:20, it will probably only have the full data for the day up to 10:00
- The report includes paused and removed campaigns, as well as enabled ones — after all, the money doesn’t get unspent just because you’ve deleted something.
The Track Google Ads Spend Script code