With the onslaught of automation from ad engines like Google, do we still care about ad text?
I think so.
Scripts are the perfect tool for implementing your automation layering strategy.
It provides a technology for you to use your simple automation to control, monitor and improve Google’s machine learning automation.
Unfortunately, as Google advertisers have adopted Smart Bidding in greater numbers, AdWords scripts have become less able to work with the new way of doing things.
The reason is simple: AdWords scripts do not support adjusting target CPA or target ROAS bids, so they are limited in their usefulness to the modern PPC marketer.
But AdWords scripts are finally starting to evolve again and will soon be replaced by scripts from Google Ads.
That’s right, almost four years later AdWords has become Google Adsit’s time to change the scripts too.
In this post, you will find an example of how you can use a Google Ads script to handle setting a target return on ad spend (tROAS) based on external factors.
How to use Google Ads to change TROAS
While you can extend this example to use any external data available through the API, we will use the real, verified example of weather bidding for the purpose of this column.
In my latest book, Upgrade the playing fieldI’ve shared an example of an auto parts store that wants to take full advantage of the sudden spike in car battery sales when the first frost of the season hits and kill car batteries that are already on their last leg.
One of the shortcomings of the “maximize conversion value” smart bidding strategy is that it most likely does not know that there is a relationship between frost and car battery sales.
But the shopkeeper has been in business since enough winters to know what to expect when the temperature drops below freezing.
Therefore, the company decided to submit more aggressive bids when there is a high probability of more sales due to weather conditions.
This means setting a lower ROAS target when the temperature drops below 32 F or 0 C.
The reason for lowering TROAS is because Google is likely to make some inaccurate predictions about conversion rates.
You’d assume typical conversion rates when in reality the conversion rate is much higher because people looking for a car battery during the first frost are more likely to have a dead battery that needs immediate replacement (rather than just shopping for a new replacement battery that may eventually die).
As Google reduces the conversion rate, and the advertiser indicates that they want to get less ROAS, these two factors will balance out and the advertiser will likely get more conversions while maintaining the same ROAS they normally get.
How to try out the new Google Ads scripts
The script relies on some functionality that is only available in the new experience, so you’ll need to toggle the setting that enables this new experience in your Google Ads account.
The text consists of two main parts:
- Fetch external data such as the expected minimum temperature for tomorrow.
- and set a new bid.
How to link weather data to Google Ads
To fetch weather data, we can use an API like the one from Open Weather Maps.
There is a free API level so you can easily test the functionality before committing any costs.
When paired with free ad text, this means that this solution won’t cost you anything to try.
With about 20 lines of code, we can write a function that queries the weather API for a specific location.
You tell it the latitude and longitude of the location you want a forecast for and then it returns the prediction for that location.
In my example I’m fetching the lowest temperature for the next day but you can easily request a different number related to the weather by updating the following line of code:
Var min = json.daily.temp.min;
Note how this code corresponds to the data from the API.
For each piece of text after the “=” sign, I’ve placed an arrow next to the associated data in the weather response below to help you understand the designation.
use JSON preview tool To navigate the weather data we will use it in our code.
How to update tROAS with Google ad scripts
Next, we need a function whose task is to change the campaign’s TROAS.
This code takes about 11 lines.
It takes the campaign name and bid adjustment as inputs and measures the current TROAS by the bid adjustment factor.
Bid adjustments are a simple multiplier.
It’s trivial to change how TROAS is changed by simply changing the formula:
newTRoas = bidAdjustment * currentTRoas
Putting parts together to change bidding depending on the weather
Finally, we write simple logic that tells our script when bids have changed.
This can be done in about 10 lines of code.
Of course, we also need some settings so we can easily change things like what campaign we’re tinkering with or what temperature we want the TROAS to adjust at, and how much we want it to change.
The settings look like this:
When we put it all together, we get the complete code that you can copy, paste and run in your Google Ads account.
This script does very simple automation for free. But chances are you’ll want to extend the functionality to really meet your own needs.
For example, if you work in many locations, you may want to change the TROAS for some external factors in each of those locations.
This means repeating the code multiple times, which is simple but not elegant.
Or you could write more elegant code that identifies the underlying geolocation where each campaign gets impressions to the site encoder and then fetches the weather data.
Ideally, you’d also label any campaigns you adjust so that you can run an automated rule the next day to restore TROAS to pre-frost levels so bids don’t remain too high after the spike in battery sales has passed.
The beauty of the scripts is that I’ve given you a working set of code that can be the basis for all of these improvements.
All the Documentation for the new scripts experience They can be found here.
It’s exciting to see Google once again investing in Google ad scripts, enabling advertisers to automate time-consuming tasks even when using modern bid management technologies.
Get the full code and Try the script from here.
- 5 things you can automate with Google Ads scripts
- 3 scripts to automate Google Ads reporting in spreadsheets
- Top 10 Pay Per Click Trends To Know In 2022
Featured image: Pepgooner / Shutterstock