Creating Dynamic Ads with Scripts

By , Senior Account Analyst at Hanapin Marketing


Consistent ad testing is one of the best practices in paid search. As account managers we are always trying to get that extra edge. What if that is not enough though and you want to update your ads even more frequently to include relevant and timely information? This is where dynamic ads come into play.

Today we are going to cover how a little knowledge of scripts can help you achieve that. Once relegated to the sorcery of the API, scripts now allow users to access these variables without the overhead.  This also means we can change ads easily without having to pre-build many spreadsheets and upload them when necessary.

Parameters allow each ad to maintain the same ID code. This means rather than pausing and replacing ads, AdWords considers this ad to be the same one. Therefore you can collect data on an ad rather than have it broken out across multiple ads.

How to Start

In order to start creating parametrized ads, you need to have the necessary parameters inserted into the specified ads. This is very similar to the way that Bing uses parameters.

You will need to include include two values {param1: default text} and {param2: default text} inserting the default ad text after the colon. These are the two locations in which the dynamic information will be inserted.

Using Google’s example from the ad parameters documentation helps illustrate the process.

Screen shot 2013-09-17 at 5.04.28 PM

In order to parametrize ads, the parameters need to be set for the keyword, ad group and index of the parameter (1 or 2). Only numbers and currency symbols can be inserted as parameters. As a result dynamic ads will be best used when you have specific data to highlight wether it be quantities, times, or pricing.

As with any ad, the length of the ad copy must fall within the character limits and the ads must be shown on the Google search network. All simple to follow and if any of these fail, the default values will be shown.

Case 1: Countdown to Sale

This script is most applicable to advertisers running timed promotions. As the holidays approach, market competition heats up as buyers flock to the web and start making purchases.

This makes ad copy vital in catching consumers who are shopping around and searching for where to buy. You can highlight the days left until free shipping, in store promotions, the number of days left until the actual holiday, etc.

The example script inserts dynamic time variables into the ads. How long do searchers have to take advantage of free shipping or how long do they have until the holiday? These reminders keep consumers aware that they have a limited time deal available or in a second case, to remember that a holiday is soon approaching.

Compared to the other examples, the code here is easier to read. What the example does is take a specified end date. It then performs the calculations, subtracting the current time from the end date, to arrive at the difference between two dates. This is a great starter for getting comfortable with using scripts and parameters.

Case 2: Inserting Statistics into Your Ads

I’m including two examples for this case. One from Google and one from Both offer similar functionality and provide great examples from which you can work and learn. Keep in mind you will need to do a bit of work on your end to connect it to your own data feed, whatever it may be.

The idea here is to create a set of parametrized ads and use an external data feed to pull in the necessary information. This could be pricing, volumes, inventory left, etc. The two examples given pull crime statistics and earth quake data.

By pulling the data from another source and using a script, you effectively maintain your dynamic ads without any work on your end. Once you set it up, everything is automated. This is great for advertisers with limited stock as you can show users how many of a product are left as well as pause ads when the inventory is depleted.

Case 3: Bid By Weather

This script is more of a bonus in that is modifies the the bids to influence which ads are shown but does not have to use parameters.

One of the first scripts that Google had on their scripts development site was the bid by weather. The script connects to a data feed for weather conditions of a given area.

Google’s use case revolves around a service and attraction that is weather dependent; this could be an amusement park, a golf course, or some sort of vacation activity. All of these probably receive more traffic on days with good conditions since not many people enjoy roller coasters in the rain. There are many ways in which you could take this idea and apply it to your account. It may not be ground breaking but it is at least fun to think about.


We covered quite a bit of material at a high level. While this is a great tool, it takes an investment of time and resources to learn how to harness the powers of scripts. There are many tutorials out there to guide you on the way. For those of you using scripts, how have you been utilizing parameters in ads? What is your most creative use case?

Twitter Facebook LinkedIn Google+ Email Print More

5 thoughts on “Creating Dynamic Ads with Scripts

  1. Sayersen

    Great article! I added scripts a while ago to automatically update prices and that has spared me a lot of manual work ever since. The other cases are surely some I’ll try out

  2. Jacob FaircloughJacob Fairclough

    Hi Russ, thanks for reading. Thanks as well for all the free content you wrote for your sites. I’ve referred quite a few people your way when they were looking for resources (which I don’t think there are enough of).

    Great job on the new script to load files from GDrive. A very clean solution to an annoying problem and something that anyone can use!

    For any readers who are interested:

  3. Sander

    Hi Jacob – great post again. Is it also possible to change the end of the month dates automatically via this script?

    Example: For the month of October: Special offers on Toys until 30. October. And then on the first of the month of November the script automatically changes that to the 30. November.

    Like this I have to set an attribute in my shop changing the date and then the API takes it and will change the date automatically in my ads?

    1. Jacob FaircloughJacob Fairclough

      That is definitely possible. It can be a little clunky if you haven’t worked with dates, but it is relatively straight forward.

      To make sure it updates each month, I would schedule the script to run monthly on the first day of the month. On the first day of each month it will run, and change the ad parameters to the last day of the current month.

      I realized the image is a little blurry here. If you click on it it’ll open up to full size and it’ll be easier to see.

      I hope this helps!


Leave a Reply

Your email address will not be published. Required fields are marked *