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
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 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>
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:
- In Google Analytics, navigate to Admin Property column: Tracking Info Data Collection and set the Remarketing toggle to On. Click Save.
- While still in the Admin section, navigate to Property column: Audience Definitions Dynamic Attributes.
- If you have not done so already, link your Google Ads account by clicking the relevant link.
- Select the Google Ads account you would like to link
- Give the link group a name in the Link group title field.
- Use the toggle switches to link one or more views of your data.
- Click Link accounts and then click Done.
- Return to Property column: Audience Definitions Dynamic Attributes.
- Click +New Attribute.
- In the Configuration section, set Business Type (such as Retail), View, and Destination account. Click Next step when done.
- 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.
- 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:
- In your Tag Manager workspace, navigate to Variables and click the New button in the User Defined Variables section.
- Click Variable Configuration and select Data Layer Variable.
- Set the Data Layer Variable Name to the name of the variable in your
dataLayer()
object. Using the abovedataLayer()
code example, this value would be set to "product_ids". - Leave the Data Layer Version set to the default value of 2.
- Name the variable. For this Retail product ID example we'll use "Product IDs".
- 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:
- Navigate to Variables and select your Google Analytics settings variable.
- Click Variable Configuration and navigate to More Settings Custom Dimensions.
- Click Add Custom Dimension.
- Use the Variable 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}}.
- 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.