In this post, we discuss automated rules & scripts on Google Ads (including examples you can use immediately!).
These tactics were extracted from an expert session given by Avishay Freund, CEO of Logos at a professional meetup hosted by Fixel.
Avishay Freund is the owner and founder of Logos Internet Marketing and an expert in Marketing, Advertising, and SEO. Advisor to public and private institutions in regards to Google advertising. Certified professional by Google. Senior lecturer at universities and colleges in internet marketing and Professional WEB technology.
This session in the video below was held in Hebrew but is summarized fully in English below.
In this session, we will discuss the two out of the three levels of automation offered by Google Ads: Rules, Scripts, and API.
Avishay’s presentation can be found here and his scripts can be found here.
Google Ads Automated Rules
Automated rules are as implied, a set of rules that are triggered once a set criteria is met. You can also set these to execute on a timely basis – hourly, daily, weekly, or even monthly.
For example, we can set an automated spend cap of 6,000$ across our account by using a rule. This will pause all campaigns in the account.
Another example is scheduling a daily email with all keywords whose quality score is 3 or lower.
Creating a rule
To create a rule you must be logged into your Google Ads account.
To create a rule that observes campaign data, navigate to the Campaigns screen, click the three dots at the top row of the campaign table and then “Create an automated rule”.
Based on the specific screen you are on, you can create an automated rule that relates to that data.
You can then select the type of automation you want to run: Enable campaigns, Pause campaigns, Change budgets or Send an email.
Rule #1: Pausing campaigns at $6,000 budget
For this example, we can choose “Pause campaigns”. The condition should be set to “Cost >6000$” and should be checked daily compared to the stats of the month to date (i.e. Same month)
Rule #2: Email alerts on low Quality Score
Create a new automation rule from the Keywords screen and select “Send email”.
Set the condition to “Quality Score <= 3” and set it to repeat daily.
Important note: Rules can be set at either account or MCC level. The key difference is for agency MCCs from which a client can move away without keeping all the rules set up.
Google Ads Scripts
Google Ads scripts are code lines that can interact with various data points available on Google Ads. They are hosted on Google’s servers, which makes them easier to manage. While they are more complex than rules, they offer much more flexibility. These too can be set on an account or MCC level.
Download Avishay’s scripts here.
Creating a Script
To create a script, simply click the Scripts option under Bulk Actions in Google Ads. Click the + button to add a new script.
Important note: You must authorize script execution on your behalf. Since this is an advanced function, it isn’t open by default on Google Ads accounts.
Script #1: Pages that don’t load
Working with clients, too often I have come across landing pages that were unavailable, although traffic from campaigns was still being forwarded to them. Technically speaking, these can be identified as pages with a 4XX or 5xx response (e.g. 404 or 503). Sending traffic to such pages is simply flushing our ad budget down the drain.
The solution I’ve devised for such errors is a simple script that runs hourly and pings all the landing pages associated with the account. The script contains two variables:
- Send an email to the address provided
- Pause the campaigns (TRUE/FALSE). If false is chosen, the script will only alert on a page being down.
You can open the script in any notepad and paste it directly into the code section. Here you can also edit the two variables available (email and pausing the campaign).
Make sure you delete the existing placeholder script before pasting in the actual script
Name the script (e.g. Broken pages) and save it. That’s it.
After you save the script, you can set the interval for which it will run (once, hourly, daily, weekly or monthly). I usually set it to run every hour. In some cases, I was able to identify changes in pages that caused downtime, much before my client did. This earned me valuable credit at the client, and also saved them some ad spend.
After the script has run, you will be able to see detailed reports of its runs on the “Script History” tab in the Scripts section.
Script #2: Self updating Google Sheets Report
This is a simple script to create an automated report of your campaigns. While this can also be done using tools such as Google’s Data Studio, this script gives an out-of-the-box solution for simple dashboarding.
You can also tweak the script to add/remove and edit elements to the Google Sheet. These work just like a standard SQL Query, any developer can adjust these to add additional data points.
The only variable in this script is the file’s name which you can of course edit. Currently, it’s set to ‘AccountDailyStats’.
Create a new script and name a memorable name (e.g. Account Daily Stats). Paste the script’s content and save it. Set the script’s run frequency to daily.
Please note that using this script requires additional permissions as it will need to access your Google Drive to create and update the reports it creates
Script #3: Pausing Inefficient Ads
Within an account, we can run a large number of ads. Naturally, some of these ads will be inefficient, i.e. not driving enough conversions or driving conversions at a cost that’s significantly higher than the account’s average. In such cases, we would want to identify and pause these ads.
The key factor to edit in this script is the window for conversions, i.e. the number days for which we want to evaluate the ad’s performance.
I’ve set the script for All Time (‘ALL_TIME’), but you can also use Last 30 days (‘LAST_30_DAYS’) or any other time frame that resonates with you.
Script #4: Hidden Keywords
This script is one of my personal favorites.
When we’re working on a Search campaign, we can often have keywords that are driving conversions, but since we use Phrase or BMM (Broad Match Modifiers) these aren’t part of the account’s keyword targeting.
This script observes the keywords that have driven conversions and adds these as keywords in the relevant campaign. Now we can adjust the bids for these specific keywords (unlike BMM).
Other examples of scripts
You can create Google Ads scripts to run virtually any task you can imagine. Here are a few examples of scripts I’ve created over the years:
- Out of stock – Monitoring an eCommerce site by scraping the product page’s HTML to identify out-of-stock items and pause their ads
- Feed based campaigns – Creating ads for new feed items (e.g. “Exclusive discount for 24 hours”), pausing ads when out of stock, updating product pricing in ads and more
- Budget management – Pausing a campaign or account exactly at a set limit
- Data injection – Infusing external data into the ad account (e.g. weather data)
- Alert system – Triggering alerts on custom events from the account
Leave a Reply