AdWords Remarketing Tag & Tag Containers

The AdWords Remarketing Tag can be implemented within tag containers such as DoubleClick Floodlight Tags or tag management systems such as Google Tag Manager.

DoubleClick Floodlight

If you already have DoubleClick Floodlight containers on your site you can use these to host your AdWords Remarketing Tag. For static remarketing the AdWords Remarketing Tag can simply be added as a "Default" tag in your Floodlight tags as usual. Please note that you cannot use image-only Floodlight tags to host the AdWords Remarketing Tag - you will only be able to host the AdWords Remarketing Tag in an iframe Floodlight.

Dynamic Remarketing

As with static remarketing, you need to add your AdWords Remarketing Tag as a "Default" tag for dynamic remarketing too. However as the DoubleClick Floodlight tag is an iframe then to pass parameters to the AdWords Remarketing Tag for dynamic remarketing then you will need to set up and use Floodlight custom variables (e.g. u1=..., u2=...) to pass parameters via the Floodlight's iframe to the AdWords Remarketing Tag.

For example, if you wanted to pass the parameter ecomm_pagetype via the Floodlight you would need to define a custom u-variable for your Floodlight configuration within DFA first. For example, if you defined u1 with a friendly name of pagetype in DFA and then created a Floodlight that includes u1 you would get a Floodlight tag like this example where the u1 parameter has been populated with a value of 'cart'

<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<img src="http://ad.doubleclick.net/activity;src=1234567;type=example123;cat=example123;u1=cart;ord=1;num=' + a + '?" width="1" height="1" alt=""/>');
</script>
<noscript>
<img src="http://ad.doubleclick.net/activity;src=1234567;type=video503;cat=example123;u1=cart;ord=1;num=1?" width="1" height="1" alt="">
</noscript>
Once the Floodlight parameter is configured, you can then add the AdWords Remarketing Tag as a Default tag to your Floodlight using DFA's %p notation, for example:
<script type="text/javascript">
var google_tag_params = {
  ecomm_pagetype: '%pu1=!;', 
};
</script>
As the u1 variable was set to 'cart' when the Floodlight was loaded, the Floodlight will automatically use the 'cart' value in the google_tag_params object.

Further details about setting up custom variables with DoubleClick Floodlights can be found in the DoubleClick Help Center.

Google Tag Manager

Google Tag Manager has built-in support for the AdWords Remarketing Tag making it very easy deploy on your site if you already have Google Tag Manager on your site. For static remarketing you only need to add a "AdWords Remarketing" tag and complete the template as usual.

Dynamic Remarketing

If you are doing dynamic remarketing you still need to create a new "AdWords Remarketing" tag in Google Tag Manager but you need a way to provide the custom parameters to the tag. To do this we recommend that you use Google Tag Manager's dataLayer to define a google_tag_params variable - full details can be found in the Google Tag Manager Help Center.

Using the dataLayer still requires you to make changes to your site even if you have already deployed Google Tag Manager. If this is undesirable then there are two approaches that offer a way to work around this restriction that will allow you to extract data from your site's pages for use with dynamic remarketing.

Using DOM Element macros

The DOM Element macro allows you to extract values from the page's DOM (Document Object Model) where the element's ID is matched. For example if your site's product pages had a product's price in a HTML element like the following code snippet:

<div>
  <span id="price">29.99</span>
</div>
You would be able to extract the 29.99 value into a macro by creating a new DOM Element macro with an Element ID of price. This macro could then be used by the AdWords Remarketing Tag tag within Google Tag Manager. In this example the price does not have a currency symbol prefix and so the value can be directly used with the AdWords Remarketing Tag - if the value in the macro did have a currency symbol like $29.99 then this would not be appropriate for use with the AdWords Remarketing Tag and you should use the Custom JavaScript macros instead as they will allow you to modify the value before using it in the AdWords Remarketing Tag.

Using Custom JavaScript macros

If your site's design has not designated DOM IDs to all of the elements you need to extract values from or you need to transform the results before using with the AdWords Remarketing Tag (for example removing currency symbols from a price) the other alternative is to use Google Tag Manager's Custom JavaScript macros. The Custom JavaScript macro will allow you to write small javascript snippets to extra content from the DOM. For example if your site's product pages had a product's price in a HTML element like the following code snippet where there is no DOM ID (so we cannot use DOM Element macros):

<div>
  <span class="price">$29.99</span>
</div>
We can create a small javascript function to extract the price value, for example using the querySelector function we could extract the price value from this snippet with the following javascript function:
function() {
  var value = '';
  var element = document.querySelector('span.price');
  if (element) {
    value = element.innerText;
    value = value.replace(/\$/,'');
  }
  return value;
}
This example first defines a default blank return value, then tries to select the DOM element that contains the price by using the querySelector function, then if we were successful in finding that element we take its inner text, remove the $ currency symbol, and then return the value which is then used as the macro's final value.

Other Containers

The AdWords Remarketing Tag can be added to other tag containers or tag management system quite simply. Some will have pre-built templates that you can use, but others may require the use of custom HTML/javascript snippets - please contact your supplier to check which options they support.

If the tag container or tag management system you are using does not offer a pre-built template for the AdWords Remarketing Tag you will need to implement the tag as a custom HTML/Javascript snippet. The approach selected will vary depending on the tag container or tag management, but you should implement either the asynchronous AdWords Remarketing Tag or the customized image tag. The asynchronous AdWords Remarketing Tag will be simpler to implement and maintain, but the customized image tag may be better suited for certain niche scenarios where space or processing possibilities are limited.

We do not recommend using the standard AdWords Remarketing Tag as it uses document.write which is unlikely to work correctly in most tag containers or tag management systems.