Count Up Your Conversions with AdWords Countdown Scripts



Who doesn’t love a countdown? Countdowns can be used at any time, whether it’s New Year’s Eve, a rocket launch, or you just want to get people excited for something that’s about to happen (unless it’s a choreographed dance you came up with at a family party). You can also tactically set up a countdown whenever you announce a release date for a product/service or an upcoming sale.


If you have set up an AdWords campaign around an upcoming sale – such as a site-wide “50% Off” sale or a holiday sale – and tried to reflect this in your ad copy. Sometimes a deal speaks for itself and you see results right away. But you also want to create a sense of urgency for consumers to purchase your goods. Up-to-date values in ad text can have an amazing impact for consumers when it comes to these limited-time offers.

One cool way to do this is to add dynamic parameters to your ad copy. If you recall, including ad text parameters can be a sneaky way to double your CTRs. In particular, Google offers a Sale Countdown Script that will automatically update your ad copy with a countdown. AdWords Scripts are a great way to automate actions in your account by entering JavaScript code. This particular script allows you update numeric values in text ads without having to pause and re-create the ad or wait for policy checks.

How to Set Up Countdown Scripts in AdWords

So how do you set these up, you ask? Well, let’s walk through the steps to get you on your way to counting down to more conversions.

Whether you have an upcoming sale or you’re a deals site, countdown parameters are a great way to show viewers what they can expect and when they can expect it. In order to add these parameters correctly to your ad copy, you will need to follow these seven steps:

Step 1

Select or create an ad group. You can also select or create a campaign, but we will get to that in a little bit.  

Step 2

Create ad copy with the parameters {param1:few} for days and {param2:&} for hours. These can be used in the headline and description lines 1 & 2

Step 3

Create a new AdWords Script by clicking on ‘Bulk Operations’ in the Navigation Panel of your AdWords account > ‘Scripts’ > then click “+ SCRIPT”

adwords script

Step 4

Enter this source code:

// Date to use to find out how many days are remaining.
var END_DATE = new Date('December 21, 2012');
// Change this to the Ad Group you set up with text ads with AdParams.
var AD_GROUP_NAME = 'Widget Sale';

function main() {
 var timeLeft = calculateTimeLeftUntil(END_DATE);
 var adGroup = getAdGroup(AD_GROUP_NAME);
 var keywords = adGroup.keywords().get();
 while (keywords.hasNext()) {
  var keyword =;
  // We want to update {param1} to use our calculated days and {param2} for hours.
  keyword.setAdParam(1, timeLeft['days']);
  keyword.setAdParam(2, timeLeft['hours']);

var DAY_IN_MILLISECONDS = 1000*60*60*24;

function calculateTimeLeftUntil(end) {
 var current = new Date();
 var timeLeft = {};
 var daysFloat = (end - current) / (DAY_IN_MILLISECONDS);
 timeLeft['days'] = Math.floor(daysFloat);
 timeLeft['hours'] = Math.floor(24 * (daysFloat - timeLeft['days']));
 return timeLeft;

function getAdGroup(name) {
 var adGroupIterator = AdWordsApp.adGroups()
   .withCondition('Name = "' + name + '"')
 if (adGroupIterator.hasNext()) {


  • The 2 most important things to pay attention to are the values in the end date variable and the ad group name variable. These will be the two values you will provide.
  • You can add multiple ad groups for this one script, say if you want to target multiple product/brand ad groups with the same sale, by changing var AD_GROUP_NAME to var AD_GROUP_NAMES & adding the various ad groups in the variable as such ‘Coat Sale, Coat Sale 2, Book Sale’
  • You can also target a campaign for a particular countdown. All you would need to do in the code is change the various versions of ‘Ad group’ with ‘Campaign’. Example, var AD_GROUP_NAME would become var CAMPAIGN_NAME

Step 5

In addition to these dynamic parameters, you can add more code to adjust for keyword bids as the sale nears/comes to an end. You are allowed to select the number of days left, in which the bids will change. The bids will adjust to be at the top of the page. It would look as such (the highlighted sequence would be added to the main function):

while (keywords.hasNext()) {
 var keyword =;
 // We want to update {param1} to use our calculated days and {param2} for hours.
 keyword.setAdParam(1, timeLeft['days']);
 keyword.setAdParam(2, timeLeft['hours']);
 if (timeLeft['days'] < 5) {
 } else {

Step 6

Once you have the script finalized, run a preview and then save it.

Step 7

Lastly, you will want to make sure the script is scheduled to run hourly, meaning the script will dynamically change the ads to adjust for the countdown by the hour.

And voila! Your countdown ad will look something like this:

countdown script

While setting up the script and ads might be a bit difficult at first, in the end you’ll have dynamic ads that will stand out against your competition. There are a number of uses outside just sales – number of days before a movie, TV show, album, or event takes place, etc. The script will be especially helpful during the holiday season to let those last-minute shoppers know just how much time they have left to Christmas!

Check out five more great AdWords scripts for beginners.

Find out how you're REALLY doing in AdWords!

Watch the video below on our Free AdWords Grader:

Visit the AdWords Grader.


David Rothwell
Nov 20, 2014

If you've actually tried to implement this you'll know there are several gotchas and a showstopper :-) Showstopper:- you have to have a "vanilla" ad active in the ad group along with the countdown ad, competing with it and making it effectively uncontrollable and useless Gotchas:- using parameters like this causes long lines of ad texts exceeding 35 char and breaking AdWords Editor (latest version)- when the timer counts down to zero the ad containing it keeps running but instead of saying "sale end in 3 hours"it now says "sale ends in" without the countdown part G has rolled this out in a very poor form and the actual implementation of it renders it pretty much unusable for now.

Nov 20, 2014

I somewhat agree to David.I hope Randi Lucius has personally tried and tested it. 

David Rothwell
Nov 21, 2014

Randi clearly has not.And neither has anyone at Google or it would have been blindingly obvious right away.

Randi Lucius
Nov 21, 2014

Hi David & Eddy,This has been tested out and was specifically used for a client that does daily deals (similar to a Groupon - so it has a number of sales going on at once) and we didn't have any issues setting it up. However, we initially ran this test earlier in the year, so changes may have been made to AdWords and/or Editor that make the implementation a bit different than when we used it.Performance wise, in some instances it worked better than a typical ad and in some instances it did not. We believe this is something that could be beneficial to promote major sales (such as Black Friday & Cyber Monday), but we definitely recommend testing out prior to these days since they are such high revenue generators. As someone has mentioned below, it does take some finagling to make sure the ad text fits and you have to be very vigilante in making sure the ads are paused when the sale ends.Thanks,Randi Lucius

Martin Roettgerding
Nov 28, 2014

Hey, nice discussion and a great example of talking past each other ;)David hasn't read the post and isn't talking about scripts...

Nov 21, 2014

I didn't know you could do this with Adwords.  Very cool.  Thanks for sharing.

Nov 21, 2014

You actually just need to be a bit clever with your ad copy and use something such as the below:Only {param1:a few} Days {param2:and} Hours Left.This way if the script doesn't work or the sale has ended, the copy will show as:Only a few Days and Hours Left.I'd also argue that if you know when your sale is ending (which you should) you'd simply schedule your ad to end at the same time as your sale...I've been using this script for months and have seen CTR's of between 30% - 50% consistently. 

Ankit Tiwari
Nov 21, 2014

This seems rather complex to do. But definetly worth trying it out.

vishal kumar
Feb 19, 2015

thank you for this article

Leave a comment