Google Analytics dynamic remarketing

Use Google Tag Manager and Google Analytics to re-engage users based on the content they’ve already seen.

Remarketing allows you to show ads to your users and customize those ads based on the content that your users experienced. With dynamic remarketing, you can take this a step further and show your site visitors an ad with the specific product they viewed on your site. This article describes how to deploy Google Analytics dynamic remarketing with Tag Manager.

Step 1: Set up Custom Dimensions in Google Analytics

When your users view content tagged with vertical attributes (for example, an ad for a specific shoe), then that information is passed to Analytics as custom dimensions. Analytics makes that information available to your Google Ads dynamic remarketing campaign.

To create custom dimensions, follow the follow the instructions in the Google Analytics help center.

Make sure you set the Custom Dimension names exactly as recommended in the custom dimensions guide. Keep in mind there will be different keys for different verticals, so be sure to look up the appropriate vertical values.

For example, the retail vertical will require an ecomm_prodid dimension, and you will need to include dimensions for ecomm_pagetype and ecomm_totalvalue since dynamic remarketing in Analytics requires them.

For each Custom Dimension, set the Scope menu to Hit. This will make it so that these actions will apply to pageviews, but won't stick to a session or user.

Record the index number for each dimension you create. You will need these index numbers later for your Tag Manager configuration.

Step 2: Set up the data layer

Work with your web developer to add the necessary attributes to your data layer. These data layer keys and values will be used by your tag to identify the product of interest. This example represents a retail store that collects the product ID, the page type, and the total value of the product:

<script>
dataLayer = [{
    'product_ids' : 'AA12345',
    'page_type' : 'product',
    'total_value' : 49
}]
</script>

To ensure the values for the dataLayer() keys are available, place the dataLayer() code above the initial Tag Manager container tag. Learn more.

Step 3: Set up Dynamic Attributes

The goal of Dynamic Attributes is to link vertical attribute information from Google Analytics to your Google Ads account. To set up Dynamic Attributes in Google Analytics:

  1. In Google Analytics, navigate to Admin and then Property column: Tracking Info and then Data Collection and set the Remarketing toggle to On. Click Save.
  2. While still in the Admin section, navigate to Property column: Audience Definitions and then Dynamic Attributes.
  3. If you have not done so already, link your Google Ads account by clicking the relevant link.
    1. Select the Google Ads account you would like to link
    2. Give the link group a name in the Link group title field.
    3. Use the toggle switches to link one or more views of your data.
    4. Click Link accounts and then click Done.
    5. Return to Property column: Audience Definitions and then Dynamic Attributes.
  4. Click +New Attribute.
  5. In the Configuration section, set Business Type (such as Retail), View, and Destination account. Click Next step when done.
  6. In the Dynamic Attributes section, set your attributes from the custom dimensions created earlier. For example, if you are using Retail, you will set Product ID to ecomm_prodid , set Page Type to ecomm_pagetype, and Total Value to ecomm_totalvalue.
  7. Click Save.

Step 4: Create audiences in Analytics

Now that you’ve updated your tags with the attributes you want to use, those attributes are then made available in Analytics. You can now use these attributes to create your remarketing audiences.

Please follow the instructions in the Analytics Help Center to learn how to create audiences.

Step 5: Create user-defined variables

In Tag Manager, create three new user-defined variables to match the data layer values and custom dimensions you just set up in Steps 1-2:

  1. In your Tag Manager workspace, navigate to Variables and click the New button in the User Defined Variables section.
  2. Click Variable Configuration and select Data Layer Variable.
  3. Set the Data Layer Variable Name to the name of the variable in your dataLayer() object. Using the above dataLayer() code example, this value would be set to "product_ids".
  4. Leave the Data Layer Version set to the default value of 2.
  5. Name the variable. For this Retail product ID example we'll use "Product IDs".
  6. Save the variable.

Repeat this process for your remaining user-defined variables.

Step 6: Add user-defined variables to Tag Manager

The final step is to add the new user-defined variables you created in Tag Manager to your Google Analytics settings variable:

  1. Navigate to Variables and select your Google Analytics settings variable.
  2. Click Variable Configuration and navigate to More Settings and then Custom Dimensions.
  3. Click Add Custom Dimension.
  4. Use the variable selector iconVariable Selector to set the dimension value for each user-defined Tag Manager variable that you created in step 5. The index values will correspond with what you recorded in step 1 when creating custom dimensions in Analytics. For instance, Index might have a value of 3, and Dimension Value might read {{Product IDs}}.
  5. Save the configuration and publish the container when ready.

If you do not want to set custom dimensions in your global Google Analytics settings variable, you can apply the custom dimension settings to the pageview tag instead. Open your Google Analytics pageview tag, click Enable overriding settings in this tag to expose the More Settings section, and follow the relevant steps above.

Related resources

Was this article helpful?
How can we improve it?