A prevalent mistake made by DIY and new ad traffickers is to neglect macro insertion. This can lead to lower impression counts, higher discrepancies and less revenue. In short, it’s bad! But it’s also easy to fix.

Macros are basically a way of passing additional information from the webpage into the ad server and to the advertisers themselves. You can read all about them here: https://support.google.com/dfp_premium/answer/1242718?hl=en

In this article, we’re interested in one of the most common macros, called CACHEBUSTER. What does a cachebuster do? To really get into the details, you need to know something about the HTTP protocol and how web serving works. We’ll neglect the technical details and opt for a simple explanation here. Basically, when someone comes to your page for the first time, their browser downloads all the scripts. One of these is your ad creative, it looks like this:

<script src="http://www.example.com/ads/12345/ad.js" type="text/javascript"></script>

That URL, http://www.example.com/ads/12345/ad.js is downloaded by the browser the first time. However, suppose your user views another page on your site. The browser does not download everything the second time! It only downloads the images and scripts it hasn’t seen previously. This is called caching. It’s incredibly important for making the web fast. (as a reminder, the discussion here is simplified, the reality of caching is more complicated, but that’s not important for our purposes) So what? Well, the advertiser who provided that creative is counting the number impressions on their end. In many cases, you will be getting paid off the advertisers own numbers. If the script is cached, it does not get loaded a 2nd time, so your impression does not get counted. What you need is a way to force the script to get loaded every time. You can do this with a cachebuster. Basically, a cachebuster adds a random number to the end of the script, tricking the browser into downloading it again.

is different from
is different from

The browser considers all of these to be completely different, so it loads them in-full, rather than using a previously downloaded copy. Advertisers will often include a placeholder in their scripts for cachebusting. When trafficking ads, you may need to tweak it slightly or replace it altogether. You might be provided with a creative that looks something like this:

<script type="text/javascript" src="http://www.example.com/ads/12345/ad.js?rand=INSERT_RANDOM_NUMBER"></script>

Or something like this:

<script src="http://www.example.com/ads/12345/ad.js?n=[TIMESTAMP]" type="text/javascript"></script>

Both of these examples indicate that a cachebuster macro is expected. These placeholders INSERT_RANDOM_NUMBER and [TIMESTAMP] are essentially generic and need to be replaced with a appropriate macro for your ad server.

To insert the macro, navigate the Add Creative screen in DFP. You will need to highlight the insertion area, typically including [braces], if present, and then click the “Cachebuster” button.


Clicking this button will replace the highlighted text with %%CACHEBUSTER%%. This is a DFP macro that will get replaced with a random number every time a new page loads. We can use the Preview Creative tool to make sure it is working properly. It’s always a good idea to preview your creatives!

Click save and return to the Preview tab. Click “new window” and the ad will appear in a new, empty window.

Now use “Inspect Element” to locate the creative. As you can see in the screenshot below, the text %%CACHEBUSTER%% has been replaced with a random number. Mission accomplished! “Preview Creative” and “Inspect Element” can be used to verify other macros as well.


A few final notes here. First, DFP can automatically handle macro-insertion for a lot of 3rd party tags. If it can be done automatically, do it! It’s still a good idea to preview and verify however. Second, not every creative needs a cachebuster. It all depends on how the 3rd party code was written. If you see [TIMESTAMP] or [INSERT_RANDOM_NUMBER], those are definite signs that a cachebuster is expected. If you’re ever unsure, we suggest contacting the advertiser or agency for clarification. A missing cachebuster can have a large impact on tracking and discrepancies.

Drop Us a Line

We’re dedicated to working with the hungriest minds in our field. If you’re involved with digital content production or digital advertising and marketing, we’d love to hear from you. Big, small, experienced or beginner, please feel free to get in contact if you think we can be of service.

Say Hello