Notification

G Suite is now Google Workspace: everything your business needs to get work done.

Google Ads dynamic remarketing

Remarketing allows you to show ads to people who have previously visited your website or used your mobile app. Dynamic remarketing takes this a step further by showing your visitors an ad with the specific product they had previously viewed on your site.

This guide will show you how to implement Google Ads dynamic remarketing with Google Tag Manager. To better understand the process, review the dynamic remarketing guide on the Google Ads help center before you attempt this tag implementation.

Overview

To tag your site for remarketing, you need to:

  • Deploy a Google Ads remarketing tag on every page of your site.

  • Pass dynamic values for each remarketing events to the remarketing tag on key steps of your site. These values can be things like the product ID of an item a user added to their cart, the origin and destination of a flight a user searched for, the promotion ID of an offer a user had clicked on, etc.)

Dynamic remarketing can be implemented for any type of online organization. The list of dynamic values that should be captured will depend on your website's business objectives. There are parameters defined for different business categories, such as education, jobs, travel, etc. See the list of events and parameters on the Google Ads Help Center, and select one that is appropriate for your organization.

The implementation steps are as follows:

  1. Populate events and parameter values
  2. Insert dynamic values in the remarketing tag
  3. Specify triggers to fire the remarketing tag
  4. Test and deploy

Populate events and parameter values

The first step in your implementation is to capture data from your website in a way that can be processed by Tag Manager. To capture data from your page, you will need to implement a Tag Manager variable. Data may be pulled in several ways, such as from 1st party cookies, the data layer, or custom JavaScript.

Insert values in the remarketing tag

Once you've configured the tag to receive the target data as variables, use those variables to insert data into Tag Manager's Google Ads remarketing tag template.

Specify triggers to fire the remarketing tag

The next step is to define triggers that tell Tag Manager when to fire each instance of the remarketing tag. You can define triggers based on built-in variables that include pageviews, link click, button click, form submit, etc. You can also create triggers based on a custom event that register in Tag Manager via the Data Layer.

Test and deploy

The last step is to test the tags on your site with Tag Manager's Preview mode. Once all the test cases have been completed and you are able to confirm that the tags are firing correctly, with the expected dynamic values, you can deploy the tags by publishing the container.

For detailed instructions on how to implement remarketing tags with Tag Manager, choose the remarketing tag implementation method that you intend to use:

Implementation Guide

This section describes how to implement Google Ads dynamic remarketing tags in Tag Manager with one instance of the remarketing tag for all steps of your purchase funnel.

The main steps for this process are:

  1. Configure your website to pass values to Tag Manager via the data layer or custom JavaScript.
  2. Create data layer variables in Tag Manager.
  3. Create triggers.
  4. Configure the remarketing tag with custom parameters.
Set up the data layer code on your site

Set up the data layer code on your site

This step is required if you choose the implementation method in which you will explicitly pass dynamic data to Tag Manager via the data layer. Work with a developer to configure the data layer code on your website. If you plan to gather the dynamic values via custom JavaScript variables through Tag Manager, skip this step.

The dataLayer() object is used to pass custom data from your site to Tag Manager. This code should be placed above your container code so that the data is available when Tag Manager executes. Below is a sample code snippet to create the data layer and then pass the user's total cart value and the list of products contained in the cart:

<script>
dataLayer = [];
dataLayer.push({
  'event': 'add_to_cart',
  'value': 998.55,
  'items': [{
    'id': 1234,
    'google_business_vertical': 'retail'}, {
    'id': 45678,
    'google_business_vertical': 'retail'}]
  });
</script>

The key names here are arbitrary and do not need to conform to any requirements (e.g. they don't need to match the custom parameter naming conventions for the Google Ads remarketing tag) but you do need to make sure that you use the same key name every time you pass to Tag Manager the same type of information.

Use JavaScript to pass an items array. The items object should have a key that corresponds to the primary identifier of the product or service (for example, ID or destination)  and a google_business_vertical key that represents the type of feed that the identifier should be matched against.

Google Chrome users can use Tag Assistant to verify that the data layer was correctly implemented and to view the data passed from the site to Tag Manager.

Some funnel steps may happen asynchronously (ie: without a full page reload). For instance, this may occur when a product is added to the cart and the page doesn't change; a success message or alert may appear instead. It is important to be able to capture dynamic cart events: Without it, you might miss a lot of shopping cart abandoners and make your remarketing efforts less accurate.

The dataLayer.push() method allows you to set variables and fire tags after Tag Manager has loaded. For example, if a user adds an item to a shopping cart, you can use this function to update the data layer:

<script>
dataLayer.push({
  'event': 'add_to_cart',
  'value': 78.45,
  'items' : [{
    'id: '1234',
    'google_business_vertical': 'retail'
  }]
});
</script>

Configure variables

Configure a Tag Manager variable for each piece of dynamic data that we want to pass to the remarketing tag. In this example, we'll have a variable for 'Event Name', 'Event Value' and a variable for 'Event Items'.

  • Event Name: The dynamic remarketing event name, which describes the event being measured. It is used by the Google Ads system to assign users to one of several automatically generated user lists. We recommend that you use a specific set of event names from the list of recommended events described in Google Ads helps center.

  • Event Value: The value of the remarketing event. This represents the total value of the products or services the user is interacting with.

  • Event Items: The list of items the user is interacting with. This variable must be an array of objects with properties following the dynamic remarketing item schema. Each item must have one or more of the following properties: 'id', 'location_id', 'origin', 'destination', 'start_date', 'end_date', 'google_business_vertical'.

See the list of events and parameters on the Google Ads Help Center.

There are several ways to capture dynamic data with Tag Manager. For example, you can pass values explicitly to Tag Manager from your website using the data layer, or you can use Tag Manager to extract it from your site if possible using custom JavaScript variables.

Update your site to pass values to Tag Manager via the data layer: This is the more robust method for remarketing tag configuration. This method will pass dynamic values directly to your remarketing tag from the data layer, but it requires that a developer make code changes on your website. We recommend that you use a specific set of event names from the list of recommended events. Once the event data is available in the data layer, create data layer variables in Tag Manager to pass these values to your tags. In Tag Manager, create a data layer variable for 'items' and another for 'value':

  1. Click Variables and then New.
  2. Select Data Layer Variable.
  3. For Data Layer Variable Name, enter 'items'.
  4. Click Save.

Repeat these steps to create a second Data Layer Variable that uses 'value' for the Data Layer Variable Name.

Developers can learn more about data layer implementations at the Tag Manager developer site.

Use custom JavaScript variables: You can alternatively use custom JavaScript code to populate the dynamic parameter values from Tag Manager with custom tags. This approach, while less robust than the former, is sometimes the most practical way of deploying the remarketing tags since it doesn't require you to make any code changes directly on your site. You can write custom JavaScript code that will pull the required dynamic values from the existing pages source code and pass it to the tag.

In general, the data needed by the remarketing tag is already present somewhere in the document and can be retrieved via JavaScript code that is injected into the page through Tag Manager. The downside of this method is that it relies on your site's source code as observed at the time of implementation, and future changes to Tag Manager may require you to revise your custom JavaScript code.

If you have implemented the data layer on your site...

Choose Data Layer Variable as the variable type, and enter the name of the data layer key from where Tag Manager can find the expected data for the variable that you need to configure.

If you have not implemented the data layer...

Without the data layer, you will need to extract the dynamic value needed from the source code. This can be accomplished with a Tag Manager JavaScript Variable. Identify the variable from your existing JavaScript code, and create a JavaScript variable in Tag Manager that uses the name of the variable.

If you do not use the data layer and rely on custom JavaScript variables to grab dynamic parameter values, it is very likely that you will need to use a different strategy to populate the same custom parameter depending on the step of the funnel.

For instance, the way you populate the product ID on a product page may be different than the way you populate the product ID on the cart page or on the purchase confirmation page, because the source code or JavaScript variables that you can piggyback on will be different for each step. Therefore, you might not be able to create a single product ID variable that will work in every circumstance. Instead, you will need to create one variable to extract the product ID for each scenario where you need this information.

Configure triggers

The next step is to set up triggers in Tag Manager for the remarketing tag. Each trigger is built by specifying a type of event, and one or more filters to specify when a tag should fire.

Pageview-based triggers

In most cases, the trigger you need to create will be based on the view of a particular page, or on a subset of pages. For example: On an ecommerce website, we'll usually want to create one trigger to fire the tag on all product pages, one trigger to fire the tag on the cart page, and one trigger to fire the tag on the purchase confirmation page.

To create a pageview trigger

  1. Click Triggers and then New.
  2. Click Trigger Configuration and select Page View.
  3. Set the trigger to fire on Some Page Views.
  4. In the section 'Fire this trigger when an Event occurs and all of these conditions are true', enter Page URL and then contains and then <path>, where <path> is a predictable part of the URL for the pages where you want this tag to fire (e.g. /products/).

To create a trigger that fires a tag on a group of pages (e.g. the product pages), use operators like "contains" or "matches regular expression" so it matches the desired page URL.

Non-URL triggers

In situations where the URL can't be used to differentiate page types, you may be able to use other variables as filters for the pageview event. For example, an ID attribute may be present:

<div id="cart_title">Shopping Cart</div>

To create a trigger that will fire when this attribute is found:

  1. Click Triggers and then New.
  2. Click Trigger Configuration and select Element Visibility.
  3. Set Selection Method to ID.
  4. In the Element ID field, enter cart_title.
  5. Set this tag to fire once per page.
  6. Set Minimum Percent Visible to 1%.
  7. Set the trigger to fire on All Visibility Events.

Asynchronous events

To ensure the best performance of your dynamic remarketing campaigns, it's important to fire tags as soon as the user completes an important step in the purchasing funnel, such as when a product is added to the cart. If a cart update doesn't lead to a new pageview, you can trigger based on a click event or a custom event.

If you have a data layer implementation, use a custom event to let Tag Manager know that a product was added to the cart and pass the relevant product information at the same time.

When an item is added to the cart, your website code should use dataLayer.push() to add an event to the data layer:

dataLayer.push({
  'event': 'add_to_cart',
  'value': 78.45,
  'items' : [{
    'id': '1234',
    'google_business_vertical': 'retail'
  }]
});

Next, create the trigger in Tag Manager:

  1. Click Triggers and then New.
  2. Click Trigger Configuration and select Other: Custom Event.
  3. Set Event Name to add_to_cart.
TIP: If you are not using the data layer, you will need to set up a click based trigger to fire a tag when the user clicks on a button. Learn more about events.

Configure tag instance

You now have all the pieces ready to be assembled. You have configured variables to receive dynamic data and have set up triggers to tell Tag Manager when to fire remarketing tags. The final step is to set up remarketing tag with the configured variables.

Here's an example remarketing tag configuration:

  1. Click Tags and then New.
  2. Click Tag Configuration and select Google Ads Remarketing.
  3. Set the Conversion ID (and optional Conversion Label) to the value provided by Google Ads. Learn more
    TIP: Use a Constant String variable for your Google Ads Conversion ID. This will make it easier to create and manage additional Google Ads tags.
  4. Check the box labeled "Send dynamic remarketing event data" and reference the Tag Manager variables that you created earlier:
    • Event Name: {{Event}}
    • Event Value: {{value}}
    • Event Items: {{items}}

Implement a conversion tag

Implement the Google Ads Conversion tag in addition to the remarketing tag to take advantage of real-time automated bidding algorithms such as Target CPA and Target ROAS. Create a new Google Ads remarketing tag, set the firing trigger to all pages, and add all the triggers you had created for the other tags as blocking triggers:

  1. Click Tags and then New.
  2. Click Tag Configuration and select Google Ads Remarketing.
  3. Set the Conversion ID (and optional Conversion Label) to the value provided by Google Ads. Learn more.
  4. Click Triggering and select a trigger that will fire on all pages.
  5. Click Add Exception and enter an exception for each trigger already covered by the custom parameters entered above.

Test and deploy

With every Tag Manager configuration, always preview and test your changes to ensure your container functions as expected. It's also a good idea to test with the JavaScript console open so you can see if your custom JavaScript code causes any errors. Test various scenarios to verify that the tag configuration behaves correctly: Add different types of products to the cart, view the cart with multiple products, etc.

When you use custom JavaScript variables or custom HTML tags, it is a best practice to write your code inside a try/catch block. If your code triggers an error (which might happen if your website code changes at some point in the future and renders your custom remarketing code configuration invalid), it will be "caught" by the JavaScript interpreter instead of raising an exception. When you test your code, remove the try/catch construct so you can observe any errors that appear in the console. When you have fixed any errors and have verified that your code works correctly, add the try/catch block back again.

After you have tested your changes, publish your container to activate your Google Ads dynamic remarketing configuration.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
8776027655824706187
true
Search Help Center
true
true
true
true
true
102259
false
false