Dynamic Remarketing with Google Tag Manager | LunaMetrics

Dynamic Remarketing with Google Tag Manager

/

blog-remarketing-gtm
Remarketing is a common method of digital advertising that many companies use to show ads to people that have visited their website in the past. For a more personalized message, dynamic remarketing can be used to tailor ads to users that feature specific products they viewed. This can be useful for encouraging users to complete a purchase when they left an item in their shopping cart, for example.

While there are a few different methods for implementing dynamic remarketing, this post aims to serve as a best-practice how-to guide to get you up and running with one of the basic methods of implementing dynamic remarketing with Google Tag Manager and AdWords. The particular industry that we will review here will be the Retail industry, although there are a variety of industries that Google supports with pre-defined attributes.

The general process will look like this:

  1. Get the information we need
  2. Put the information into the data layer
  3. Configure a remarketing campaign in AdWords
  4. Configure GTM to collect the dynamic information for use in the remarketing campaign

You will need to have Advertising Features enabled in your Google Analytics account and have your Analytics and AdWords accounts linked in order to use Dynamic Remarketing. Retail Dynamic Remarketing, which we will be talking about here, also requires that you link your Google Merchant Center and AdWords accounts as well.

Let’s get started!

1. Get the Information We Need

The first step in setting up Dynamic Remarketing is to find the relevant information that you want to use for your remarketing strategy. This will vary based on your business type and goals, and may be product- or service-related. For this post, we will be talking primarily about the retail industry, so this information will be product-related.

For example, we are going to use a product ID, page type, and product value. Ecommerce tracking also requires some of these values, which means that if we have ecommerce configured already we should be able to repurpose a lot of that data for remarketing; and we do not need to go back to our developers and ask that they make yet another update to the page.

To find out exactly which pieces of information you will need (and which ones you are required to have in order for this to work), take a look at the Google Developers Remarketing resource article, which provides a list of industry-specific parameters such as for education, travel and more.

So what do those parameters mean? Each parameter’s purpose is defined in the Help article mentioned above, but let’s take a closer look at the retail parameters:

  • ecomm_prodid: This is the ID of the product viewed on a given page. This parameter is required whenever the ecomm_pagetype is set to product or cart. More than one product ID can be passed on cart pages.
  • ecomm_pagetype: This designates the type of page that was viewed. Possible values include home, searchresults, category, product, cart, purchase or other. You will need to map the pages on your site to fit into one of these categories.
  • ecomm_totalvalue: This is the value of the product viewed, which may change depending on whether the product is being viewed from a product detail page or in a cart.
  • ecomm_category: This is the category to which the product or category page being viewed belongs.

Additional information can be passed along within custom parameters as well, such as productname, productsale, etc.

An important takeaway here is that certain parameters are required for each website type, such as ecomm_prodid for retail websites. Refer to the documentation to make sure that you include the required parameter(s) for your industry.

2. Put the Information in the Data Layer

In a manner similar to that of ecommerce tracking, a script needs to be placed on applicable pages that dynamically populates the data we just described in order for us to grab it with GTM and use it for our remarketing purposes. The script should be placed on key pages of your website, such as on checkout steps, for example. It is most efficient to dynamically populate all of the variables you need. If you cannot dynamically populate the pagetype-specific variable, you can create separate tags for each page type.

Another, less preferred option is to use a DOM element variable to pull information off the page. If you use this method, make sure to set your remarketing tag to fire on gtm.dom instead of on the pageview. More details on these and other options can be found from the documentation pointed out above, although the steps explained in that documentation almost make the process more confusing – so we’re going to use a dynamic pagetype parameter.

Configure dataLayer.push declaration that defines the variables you need. This data layer should be placed above the GTM container and would look something like this:

Followed by your standard GTM container:

3. Configure a Remarketing Campaign in AdWords

In your AdWords account, create a remarketing campaign in your AdWords account and generate the remarketing tag in the Audiences section of your AdWords Shared Library. Be sure to check the “use dynamic ads” checkbox and then select your industry.

create a remarketing audience

Once you create your new remarketing tag, remember your Conversion ID and Conversion Label for our next and final step.

4. Configure GTM to Collect the Dynamic Information for Use in the Remarketing Campaign

Now that the on-page code is configured and you have your Conversion ID and Label, we can finish the implementation within GTM.

Create new Data Layer Variables for the data you want to pull out of the data layer. For example, ours will look like this:

remarketing data layer variable

remarketing data layer variable

remarketing data layer variable

Then create a new AdWords Remarketing tag – insert into the tag your Conversion ID and Conversion Label:

remarketing tag in GTM

Under the Custom Parameters options, we selected “Manually Specify” since we are repurposing information that is already available to us in the data layer from our ecommerce configuration – this is where we add the key-value pairs for each of our data layer variables. Repurposing data layer variables helps reduce the number of requests we need to make to IT teams. It is important to note that the keys need to be in the specific remarketing format you see above.

You also have the option to select “Use Data Layer” which would automatically grab the parameters for you – but you would instead set up your data layer so that each of your remarketing parameters are inside a single object, such as in this example:

In this case, you would need a Data Layer Variable called google_tag_params to insert into the remarketing tag so that GTM knows where to find the parameters it needs:

remarketing tag in GTM

Since we are populating the ecomm_pagetype parameter dynamically and before the GTM snippet, we can use a Pageview trigger to fire the tag.

Test and publish your new tags, and you’re all set!

There are a few different ways you could go about configuring dynamic remarketing with Google Tag Manager. The process described here aims to be as straightforward as possible, reusing information that is already available to us for our retail remarketing example. If you have used other methods or have some useful tips from your own experience, please share in the comments.

Amanda Schroeder is an Analytics Engineer and comes from the marketing industry where she found a need for accurate, insightful data that could aid in making results-driven decisions. Amanda’s passion for building solid measurement strategies and connecting all the pieces of integrated digital and traditional marketing campaigns has led her to her current role at LunaMetrics.

  • akkkkkar

    Very useful, thank you. Made our retargeting campaign run in 48 hours. Perhaps you also should say something more about how to configure the campaign in Google AdWords.

  • Rahul

    Hi, thanks for post. What will be the logic if someone does not want to fire this on cart page. I read on support page of google that this should not fire on cart page?

    • Amanda

      Hi Rahul,

      If you take a look at the documentation for retail sites (link below), you can see that the required ecomm_pagetype can be either “product” or “cart” – which indicates the type of page that the tag is on. If you do not want a particular tag to fire on a specific page, you can use a blocking trigger.

      Here is the link to the documentation:

      https://developers.google.com/adwords-remarketing-tag/parameters#retail

      Hope that helps clarify things!

  • Wrig Mark

    Great Post!! Nicely done the key part of dynamic remarketing.

  • Andrey

    Hi, thanks for post.
    Is it possible to do like this:

    dataLayer = [];




    dataLayer.push({
    ‘job_pagetype’: ‘offerdetail’,
    ‘job_id’: ‘123’,
    ‘job_locid’ : ‘UA-7’
    });

    declare details below GTM?

    • Amanda

      Hi Andrey,

      If you want to declare the data layer ecommerce information after the GTM container, you will need to add a GTM event and change the trigger for your remarketing tag so that it fires only when the ecommerce information it is available (when the GTM event is pushed into the data layer).

      For example:

      dataLayer.push({
      ‘event’:’rkgInfoReady’,
      ‘job_pagetype’: ‘offerdetail’,
      ‘job_id’: ‘123’,

  • Terral

    Hello Amanda,

    Thanks for the great article! I’ve had a hard time recently finding detailed information on Google Tag Manager, and LunaMetrics has been a god sent!

    I have a few quick question regarding the DataLayer:
    1) For a dynamic remarketing tag to work, do I have to have a custom DataLayer push for each product I have listed on my website?
    2) Is there a way to dynamically populated the ProdID, Pagetype, Category and Total Value?
    3) Finally, do I need to insert the code for the datalyer push on every product page or can I simply insert one code on my checkout page that automatically populates with the correct parameters?

    Thanks!

    • Amanda

      Hello Terral,

      I’m glad you’re finding our posts helpful. To answer your questions –

      1.) No, you do not necessarily need the code for every product you have on your website. Depending on what your overall goal is, you may want to use remarketing for all of your products, or just particular products in a certain category, for example.

      2.) You can dynamically populate the data layer values by programmatically adding them via your server-side code. You may need to talk with your IT staff or whoever set up your website in order to make this work. The information is already there on your server, it’s just a matter of surfacing it in a way that GTM can use it.

      3.) If you want to only remarket to users who have seen a checkout step page, you can do that. You do not need to remarket to users who have only seen a product page. Just remember to specify the ‘ecomm_pagetype’ value of ‘cart.’

      Best,

      Amanda

  • AJ Saunders

    Thanks for providing a common sense – step by step guide. I’ve being trying to get this to work for about 8/9 months and you provided a solution that google couldn’t!

    • Amanda

      Glad to hear this was helpful to you AJ!

  • Arun kumar Jha

    Hello Amanda,

    Below are the data layer script i set up for dynamic re-marketing. Please check and let me know it will work or not. I will set up remarketing tag by using tag manager.

    var dataLayer = window.dataLayer || [];

    dataLayer.push({

    ‘google_tag_params’: {

    ‘event’ : ‘dynamic_rm’,

    ‘edu_pid’ : ‘Value’,

    ‘edu_pagetype’ : ‘Value’,

    ‘edu_url’ : ‘Value’,

    ‘edu_course’ : ‘value’,

    ‘edu_technology’ : ‘value’

    }

    });

    • Amanda

      Hello Arun,

      Sorry for the late response. This format looks appropriate to me, as long as you’re using the appropriate values for the predefined parameters (such as ‘home’ or ‘searchresults’ for the ‘edu_pageType’ param).

  • Singh Birendra

    Hi,

    I have question over your statement -“You will need to have Advertising Features enabled in your Google Analytics account and have your Analytics and AdWords accounts linked in order to use Dynamic Remarketing.”

    If we are collecting remarketing data via GTM, then why we need Advertising Features enabled in Google Analytics and what is the need of Analytics and AdWords accounts linking?

    As I know, if we are running dynamic remarketing via Google Analytics code then both above said are required.

    Can you please give more details on your statement.

    Thanks
    Birendra Singh

    • Amanda

      Hi Birendra,

      If you want to see Demographics and Interests reports, for example, you will need to enable Remarketing and Advertising Reporting Features in Google Analytics.

      Additionally, if you want to use the dynamic remarketing audiences of Google Analytics in Google AdWords, you will need to have Google Analytics and Google AdWords linked.

      Best,
      Amanda

Contact Us.

LunaMetrics

24 S. 18th Street, Suite 100,
Pittsburgh, PA 15203

Follow Us

1.877.220.LUNA

1.412.381.5500

getinfo@lunametrics.com

Questions?
We'll get back to you
in ONE business day.