Setting up AdWords Dynamic Remarketing using Google Tag Manager

Remarketing is a powerful feature which allows you to sell to people who have already visited your site and are interested in your products.

Using AdWords dynamic remarketing, you can take this a step further and advertise visitors the actual product they were interested in. Allowing you to customize your message based on the product they viewed or added to cart or even purchased (think complimentary products to upsell!).

To do this sort of remarketing we need to collect a bit more structured data. This requires placing special tags on each of your pages. It requires you to link Google Merchant Centre Account with Adwords. Details. The below post details how technical implementation can be done using google tag manager.

Step 1: Add Tags to all your site pages

For Dynamic Tagging we need to tag each page on the site with tags. The tag will be built by building a js object. It needs to be added as early on the page as possible preferably right after opening body.

<script>
 var google_tag_params = {
  'ecomm_pagetype': 'purchase',       //set the pagetype value
  'ecomm_pcat': ['electronics', 'books'],   // product category
  'ecomm_prodid': ['123A', 'H456'],      // sku
  'ecomm_pname': ['Nexus','Router'],    // product name 
  'ecomm_pvalue': [99, 19.99],      // product value
  'ecomm_totalvalue': '118.99'      // total value
};
</script>

The ecomm_pagetype key is required and needs to be set for each page.

The value for pagetype can be home, searchresults, category, product, cart, purchase, other

All other fields can be set as needed and if not available can be left as blank quotes ”

————————————

On the homepage

just set pagetype and leave other keys blank.

'ecomm_pagetype': 'home'

————————————

On Category page set

'ecomm_pagetype': 'category',
'ecomm_pcat': ['electronics'] // category name, separate by commas if multiple cats

————————————

On Product page set

'ecomm_pagetype': 'product', //set the value
'ecomm_pcat': ['electronics'], // product category
'ecomm_prodid': ['123A'], // sku
'ecomm_pname': ['Nexus'], // product name

————————————

Cart Page

Pass values for all items in the cart

'ecomm_pagetype': 'cart',
'ecomm_prodid': ['123A', 'H456'], // id (sku)
'ecomm_pname': ['Nexus','Book'], // product name
'ecomm_pcat': ['electronics', 'books'], // category
'ecomm_pvalue': [599, 19.99], // individual product values
'ecomm_totalvalue': '118.99' // total cart value

————————————

Purchase

On order confirmation page add

'ecomm_pagetype': 'purchase', //set the value
'ecomm_pcat': ['electronics', 'books'], // product category
'ecomm_prodid': ['123A', 'H456'], // sku
'ecomm_pname': ['Nexus','Router'], // product name
'ecomm_pvalue': [99, 19.99], // product value
'ecomm_totalvalue': '118.99' // total value

————————————

All other pages set

'ecomm_pagetype': 'other'

————————————

Below the tags we would add dataLayer which sends the data to Google Tag Manager. End result would look something like this for a product page:

<!-- Dynamic remarketing tag  should always be above dataLayer.push --> 
<script>// <![CDATA[
var google_tag_params = {   
'ecomm_pagetype': 'product',  //set the value   
'ecomm_pcat': ['electronics'],  // product category   
'ecomm_prodid': ['123A'],   // sku    
'ecomm_pname': ['Nexus']    // product name  
};
// ]]></script>

Standard code for container on everypage

<script>
dataLayer = [];
</script>
<script>
YOUR GTM container code
</script>

Send data to gtm via dataLayer.push

<script>
dataLayer.push ({   
 'event':'remarketingTriggered',
 'google_tag_params': window.google_tag_params 
});
</script>

Step 2: Google Tag Manager setup

Next step is to setup remarketing tag in GTM and specify rules and macros to trigger them.

Tag:

Create a new tag in your GTM container. In the next step select Adwords Remarketing as the tag type.

Go to your adwords account and create a new remarketing tag.  Here is how to create a remarketing tag.

From the tag get your Conversion ID and Conversion Label.

 conversion id & conversion label conversion id & conversion label

Macro:

Next we need to tell the tag where to get the product information we have specified on the page. To do this we’ll create a macro. In custom parameter section select ‘Use Data Layer Variable’.

In Data Layer Variable select new macro.

On the popup select Macro Type: Data Layer Variable. Name the macro google_tag_params and use Data Layer Variable

Name: google_tag_params

 Datalayer variable name Datalayer variable name

End result will look something like this:

 adwords dynamic remarketing tag adwords dynamic remarketing tag

Rule:

Now we need a rule to tell gtm when to trigger the tag. Click Add Rule to Fire Tag. On popup select Create new rule.

Since we have added the tags to every page Specify a rule that fires the tag on all pages of your domain. Create a rule with   {{event}} contains remarketingTriggered And save the rule.

gtm_event_for_adwords_dynamic_remarketing gtm_event_for_adwords_dynamic_remarketing

Now just save the tag , create a new version of container and publish it and you’ll be done.  Get cracking with creating new tailored ads for your customers and see your sales go up :).

This should help you get started. Let us know how it goes in the comments.

Comments

  • Lance

    Hussain,
    I\’m trying to implement this as you explained and as explained in the google developers page. How do I get those variable in the coding of each product page? Do I need to hard code those into each page?

    Thanks for putting this post together.

    Lance

    • Hussain

      Yes Lance you\’ll need to setup the variables with the datalayer in your template. You can then dynamically populate the variable values on each page.

  • lui

    Hi Hussain,is all this implementation still valid for today?
    Thank you

    • Hussain

      yes it is.

      • lui

        Thank you !! Also , once you linked your adwords and goolge merchant account ,¿is it necessary to create a product data feed ? In afirmative case i suppose you should be consisten of your ecomm_prodid: [\’123A\’], thank you !!

  • Ryan Grant

    This code \”var google_tag_params\” is the the normal code to copy/paste on your page without Tag Manager. All you are doing is adding Tag Manager for no reason and the remarketing is just double firing.

    So rather it should be switched to dataLayer.push, and then it gets pushed to the data layer.

    • Hussain

      var google_tag_params is just a variable, further down you\’ll see how we are using it to create a macro in gtm.
      Once you have implemented this you should remove your old adwords remarketing code added on the page.

  • Jay Lo

    Hi Hussain,
    Is it a problem, if we manually specify the custom params through GTM instead of creating a google_param variable?

    On detail:

    On the data.layer we pushed the params like this:

    window.dataLayer = window.dataLayer || []; dataLayer.push({ \’listing_id\’: \’15655\’, \’listing_pagetype\’: \’offerdetail\’, \’listing_totalvalue\’: 800 });

    And then we created a macro for each custom parameter. And then we assign them manually in the Adwords Remarketing Tag, instead of using the data.layer google_param variable.

    Could this be a problem? Because our adwords account is not detecting the custom parameters though the remarketing tag in google tag assistant has the requests for those params.

    Looking forward for your answer.

    Thanks

Leave a Reply

Your email address will not be published.