Dynamic Remarketing With Google Tag Manager

June 18, 2015
Dynamic Remarketing With Google Tag Manager

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.