With the continuing onslaught of automation from the ad engines like Google, should we still care about ad scripts?

I believe so.

Scripts are the perfect tool to execute an automation layering strategy.

They give you a technique to use your own simple automations to control, monitor, and improve more sophisticated machine learning automations from Google.

Unfortunately, as Google advertisers have adopted smart bidding in larger numbers, AdWords scripts have become less capable of working in the new way of doing things.

The reason is simple: AdWords Scripts don’t support modifying target CPA or target ROAS bids, so they’re limited in how useful they can be for the modern PPC marketer.

But AdWords Scripts have finally started evolving again and will soon be replaced by Google Ads Scripts.

That’s right, almost four years after AdWords became Google Ads, it’s time for scripts to make the change, too.

In this post, you’ll find an example of how you can use a Google Ads script to manipulate your target return on ad spend (tROAS) setting based on external factors.

How To Use A Google Ads Script To Change tROAS

While you can extend this example to use any external data that is available through an API, we’ll use the true-and-tried example of bidding by weather for the purpose of this column.

In my recent book, Unlevel the Playing Field, I shared an example of an automotive parts store that wants to take full advantage of a spike in car battery sales when the season’s first frost hits and wipes out car batteries that were already on their last leg.

One shortcoming of the “maximize conversion value” smart bidding strategy is that it likely doesn’t know there is a correlation between frost and car battery sales.

But the store’s owner has been in business for enough winters to know what to expect when the temperature dips below freezing.

So the company decides to bid more aggressively when there is a large potential for more sales due to weather conditions.

That means setting a lower target ROAS when the temperature goes below 32 Fahrenheit or 0 degrees Celsius.

The reason for lowering the tROAS is that Google will likely make some inaccurate predictions about conversion rates.

It will assume typical conversion rates when in reality the conversion rate will be 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 battery to replace one that may eventually die).

As Google underestimates the conversion rate, and the advertiser indicates a willingness to get a lower ROAS, these two factors will balance out and the advertiser is likely to get more conversions while still maintaining the same ROAS they usually get.

How To Try The New Google Ads Scripts

The script relies on some functionality that is only available in the new experience so you will need to toggle the setting that enables this new experience in your Google Ads account.

Google Ads script settingsScreenshot from Google Ads, February 2022

The script consists of two core parts:

  • Fetching external data like the min forecast temperature for tomorrow.
  • And setting a new tROAS bid.

How To Connect Weather Data To Google Ads

To fetch weather data, we can use an API like that from Open Weather Maps.

There is a free tier of the API so you can easily test the functionality before committing to any costs.

Paired with a free Ads Script, this means this solution won’t cost you anything to try.

With just about 20 lines of code, we can write a function that queries the weather API for a particular location.

You tell it the latitude and longitude of the location for which you want a forecast and then it returns the forecast for that location.

Weather API free script codeScreenshot from Google Ads, February 2022

In my example, I am fetching the lowest temperature for the next day but you could easily request a different weather-related number by updating the following line of code:

Var min = json.daily[0].temp.min;

Note how that code corresponds to the data from the API.

For every part of the text after the “=” sign, I have placed an arrow next to the associated data in the weather response below to help you understand the mapping.

JSON Viewer for weather code scriptScreenshot from JSON Viewer, February 2022

Use a JSON preview tool to navigate the weather data we’ll use in our code.

How To Update tROAS With Google Ads Scripts

Next, we need a function whose job it is to change the tROAS of a campaign.

That code takes about 11 lines.

code to set function to change the tROASScreenshot from Google Ads, February 2022

It takes a campaign name and a bid adjustment as inputs and it scales the current tROAS by the bid adjustment factor.

The bid adjustments is a simple multiplier.

It’s trivial to change how the tROAS is changed by simply changing the formula:

newTRoas = bidAdjustment * currentTRoas

Putting The Parts Together To Change Bid By Weather

Finally, we write the simple logic that tells our script when to change the bids.

This can be done in around 10 lines of code.

code to get lowest temperature Screenshot from Google Ads, February 2022

Of course, we also need some settings so that we can easily change things like the campaign we’re manipulating or the temperature at which we want to adjust the tROAS, and how much we want to change the tROAS.

The settings look like this:

setting metrics code Google Ads scriptScreenshot from Google Ads, February 2022

When we put it all together, we get the complete code that you can copy and paste and run in your own Google Ads account.

Scripts Housekeeping

This script does very simple automation for free. But chances are you will want to extend the functionality to really meet your own needs.

For example, if you operate in many locations, you may want to change the tROAS for some external factor in each of those locations.

That means repeating the code many times, which is simple but not elegant.

Or, you could write more elegant code that maps the primary geo-location where each campaign gets impressions to a location encoder and then fetches the weather data.

Ideally, you’ll also label any campaigns you adjust so that you can run an automated rule the next day to restore the tROAS to pre-frost levels so that bids don’t remain too high after the spike in battery sales has passed.

The beauty of scripts is that I’ve given you a working set of code that can be the basis of all these enhancements.

All the documentation for the new scripts experience can be found here.

Conclusion

It’s exciting to see Google once again investing in Google Ads scripts, enabling advertisers to automate their most time-consuming tasks even when using modern bid management techniques.

Grab the full code and try the script from here.

More resources:


Featured Image: Pepgooner/Shutterstock


Source link