Add the dynamic remarketing tag to your site

To use dynamic remarketing, you'll need to add the dynamic remarketing tag with custom parameters to your website so that your lists can start working. When adding the tag and customizing it with custom parameters that suit your business, it helps to work with a technical member of your team like a web developer.

In this article:

  • About the tag and custom parameters
  • Custom parameters for all business types
  • Formatting custom parameters and identifying common errors
  • Alternative tag implementations

About the tag and custom parameters

The dynamic remarketing tag collects data, such as the IDs of the products or services that people viewed on your website, the types of pages viewed (such as shopping cart pages), and the total value of items.

Here’s an example of an airline’s tag where the custom parameters are green, the remarketing tag is blue, and dynamic unique values are highlighted yellow.

<script type="text/javascript">
var google_tag_params = {
flight_destid: "REPLACE_WITH_STRING_VALUE",
flight_pagetype: "REPLACE_WITH_STRING_VALUE",
flight_totalvalue: REPLACE_WITH_NUMBER_VALUE
};
</script>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = xxxxxxxx;
var google_custom_params = window.google_tag_params;
var google_remarketing_only = true;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/xxxxxxxx/?value=0&guid=ON&script=0"/>
</div>
</noscript>

You can get your tag from your AdWords account by going to the "Audiences" section of your Shared library. You’ll want to have the entire code snippet on each page of your site, just before the </body> tag. The code should use JavaScript Literal Object Notation, a format for transmitting structured data over a network connection. If you already have a standard remarketing tag and want to start using dynamic remarketing, you can make a few changes to your existing tag. These changes will let you send additional information to AdWords through your tag.

If you use Google Analytics, you’ll have the option to use the Google Analytics tracking code that’s already on your site instead of using the AdWords remarketing tag. Another alternative for implementing your tag is to use Google Tag Manager.

Important: Your remarketing tag shouldn't be associated with any personally identifiable or sensitive information. Sensitive categories of sites can't use remarketing. If you're setting up a remarketing campaign and placing the remarketing tag on your site, you need to follow the Policy for advertising based on interests and location.

Custom parameters for all business types

Custom parameters are the only way to dynamically send values to your AdWords account based on information on the page, such as product ID. Custom parameters can have multiple values. For example the custom parameter "flight_destid" might have multiple values like "PAR, "NYC," and "SFO." For dynamic remarketing, you'll need to at least use the required custom parameters. To see a list of predefined custom parameters, choose your business type below or visit the Google developers site.

Education
Custom parameter Sample values Definition
edu_pid* 1255, 1255-A01 ID allows the dynamic ad to show people the exact course or program they viewed.
edu_plocid NYC Location ID allows the dynamic ad to show people the exact course or program they viewed.
edu_pagetype** home, searchresults, program, lead, complete, other Page type indicates which pages people visited. Must be all of the following to use automatically created lists:
  • One of the values listed in the middle column.
  • In English, even if your site is in a different language.
edu_totalvalue** 1000.00 Total value is the value of the program. On "complete" pages with multiple courses and programs, total value is the sum of all items.

*Required
**Recommended

Flights
Custom parameter Sample values Definition
flight_destid* PAR Destination ID allows the dynamic ad to show people the exact they viewed.
flight_originid LON Origin ID allows the dynamic ad to show people the exact origin they viewed.
flight_pagetype** home, searchresults, offerdetail, cart, purchase

Note: "offerdetail" is a page with more in-depth information about the offer, compared to a "searchresults" page.
Page type indicates which pages people visited. Must be all of the following to use automatically created lists:
  • One of the values listed in the middle column.
  • In English, even if your site is in a different language.
flight_startdate** 2014-08-01 Start date of the flight. Must have YYYY-MM-DD format. Flights paired with start dates that have passed will be excluded when the ad is shown.
flight_enddate 2014-08-08 End date of the flight. Must have YYYY-MM-DD format.
flight_totalvalue** 100.00 Total value is the value of the flight. On "cart" pages with multiple flights, total value is the sum of all items.

*Required
**Recommended

Hotels and rentals
Custom parameter Sample values Definition
hrental_id* 52639, 52639-NYC ID allows the dynamic ad to show people the exact hotel or rental they viewed.
hrental_pagetype** home, searchresults, offerdetail, conversionintent, conversion, other

Note: "offerdetail" is a page with more in-depth information about the offer, compared to a "searchresults" page. "conversionintent" is a page just before the conversion page.
Page type indicates which pages people visited. Must be all of the following to use automatically created lists:
  • One of the values listed in the middle column.
  • In English, even if your site is in a different language.
hrental_startdate 2014-08-01 Start date of the rental. Must have YYYY-MM-DD format. Hotels and rentals paired with start dates that have already passed will be excluded.
hrental_enddate 2014-08-08 End date of the rental. Must have YYYY-MM-DD format.
hrental_totalvalue** 100.00 Total value is the value of the hotel or rental. On "conversion" pages with multiple rentals, total value is the sum of all items.

*Required
**Recommended

Jobs
Custom parameter Sample values Definition
job_id* 1255 ID allows the dynamic ad to show people the exact job they viewed.
job_locid NYC Location ID allows the dynamic ad to show people the exact job they viewed.
job_pagetype** home, searchresults, offerdetail, conversionintent, conversion, other

Note: "offerdetail" is a page with more in-depth information about the offer, compared to a "searchresults" page. "conversionintent" is a page just before the conversion page.
Page type indicates which pages people visited. Must be all of the following to use automatically created lists:
  • One of the values listed in the middle column.
  • In English, even if your site is in a different language.
job_totalvalue** 100000.00 Total value is the value of the job. On "conversion" pages with multiple jobs, total value is the sum of all items.

*Required
**Recommended

Local deals
Custom parameter Sample values Definition
local_id* 1234 ID allows the dynamic ad to show people the exact local deal they viewed.
local_pagetype** home, searchresults, offerdetail, conversionintent, conversion

Note: "offerdetail" is a page with more in-depth information about the offer, compared to a "searchresults" page. "conversionintent" is a page just before the conversion page.
Page type indicates which pages people visited. Must be all of the following to use automatically created lists:
  • One of the values listed in the middle column.
  • In English, even if your site is in a different language.
local_totalvalue** 100.00 Total value is the value of the local deal. On "conversion" pages with multiple deals, total value is the sum of all items.

*Required
**Recommended

Real estate
Custom parameter Sample values Definition
listing_id* mtv_12345 ID allows the dynamic ad to show people the exact listing they viewed.
listing_pagetype** home, searchresults, offerdetail, conversionintent, conversion, other

Note: "offerdetail" is a page with more in-depth information about the offer, compared to a "searchresults" page. "conversionintent" is a page just before the conversion page.
Page type indicates which pages people visited. Must be all of the following to use automatically created lists:
  • One of the values listed in the middle column.
  • In English, even if your site is in a different language.
listing_totalvalue 600000.00 Total value is the value of the listing. On "conversion" pages with multiple listings, total value is the sum of all items.

*Required
**Recommended

Retail

You’ll need a Google Merchant Center account to use dynamic remarketing for your retail business.

Custom parameter Sample values Definition
ecomm_prodid* 1234 ID allows the dynamic ad to show people the exact product they viewed.
ecomm_pagetype** home, searchresults, category, product, cart, purchase, other Page type indicates which pages people visited. Must be all of the following to use automatically created lists:
  • One of the values listed in the middle column.
  • In English, even if your site is in a different language.
ecomm_totalvalue** 49.99 Total value is the value of the product. On "cart" pages with multiple products, total value is the sum of all items.

*Required
**Recommended

Travel
Custom parameter Sample values Definition
travel_destid* PAR ID allows the dynamic ad to show people the exact travel option they viewed.
travel_originid LON ID allows the dynamic ad to show people the exact travel option they viewed.
travel_pagetype** home, searchresults, offerdetail, conversionintent, conversion, other

Note: "offerdetail" is a page with more in-depth information about the offer, compared to a "searchresults" page. "conversionintent" is a page just before the conversion page.
Page type indicates which pages people visited. Must be all of the following to use automatically created lists:
  • One of the values listed in the middle column.
  • In English, even if your site is in a different language.
travel_startdate 2014-08-01 Start date of the trip. Must have YYYY-MM-DD format. Travel options paired with start dates that have already passed will be excluded.
travel_enddate 2014-08-08 End date of the trip. Must have YYYY-MM-DD format.
travel_totalvalue** 100.00 Total value is the value of the travel option. On "conversion" pages with multiple travel options, total value is the sum of all items.

*Required
**Recommended

Custom
Custom parameter Sample values Definition
dynx_itemid* Sedan, 72103 ID allows the dynamic ad to show people the exact item they viewed.
dynx_itemid2 Red Optional second ID allows the dynamic ad to show people the exact item they viewed.
dynx_pagetype** home, searchresults, offerdetail, conversionintent, conversion, other

Note: "offerdetail" is a page with more in-depth information about the offer, compared to a "searchresults" page. "conversionintent" is a page just before the conversion page.
Page type indicates which pages people visited. Must be all of the following to use automatically created lists:
  • One of the values listed in the middle column.
  • In English, even if your site is in a different language.
dynx_totalvalue** 20000.00 Total value is the value of the item. On "conversion" pages with multiple items, total value is the sum of all items.

*Required
**Recommended

Formatting custom parameters and identifying common errors

Formatting and examples

Formatting custom parameters

  • For pages with multiple IDs like shopping cart pages, use brackets to group IDs. Example: flight_destid: ["123", "456"]
  • Use single or double quotes for string custom parameters. Either single or double quotes will work, but should always be consistent. Example: If you choose to use single quotes, use them for all values.
  • Don’t use quotes for numerical custom parameters. Example: flight_totalvalue: 200.99
  • Separate parameters with commas. If you don't include commas, the tag won't work properly.
  • Custom parameters can only contain letters, digits, and underscores. Custom parameters shouldn’t begin with digits or include spaces.
  • For optimal setup, use the recommended values in this article because these will form lists that AdWords already creates for you when you set up your dynamic remarketing campaign. Additional values can be used to define other pages specific to your site.

Examples of custom parameters

Here's an example for an airline's website with all the basic custom parameters implemented.

Site section Custom parameter tag sample Notes
Home <script type="text/javascript">
var google_tag_params = {
flight_destid: "",
flight_pagetype: "home",
flight_totalvalue:
};
</script>
On the homepage, you have information about the page type.

Although there may not be any product or service information on these pages, AdWords can still pull products and services from your feed based on what is likely to perform the best.
Search results page <script type="text/javascript">
var google_tag_params = {
flight_destid: "",
flight_pagetype: "searchresults",
flight_totalvalue:
};
</script>
On the search results page, you have information about the page type.
Offer detail page <script type="text/javascript">
var google_tag_params = {
flight_destid: "123",
flight_pagetype: "offerdetail",
flight_totalvalue: 99.00
};
</script>
On the offer detail page, you can dynamically fill in information about the product or service being viewed. Use the same ID from your feed.
Cart page Single destination
<script type="text/javascript">
var google_tag_params = {
flight_destid: "123",
flight_pagetype: "cart",
flight_totalvalue: 120.00
};
</script>


Multiple destinations
<script type="text/javascript">
var google_tag_params = {
flight_destid: ["SFO", "SJC", "NYC", "LAX"],
flight_pagetype: "cart",
flight_totalvalue: [120.00, 300.00, 500.00, 900.00]
};
</script>
On the cart page you should send all the items you have in the cart. When you have multiple values in a parameter, use a JavaScript array (brackets). In the "xxxxxxxx_totalvalue" parameter, you need to send the sum of the values in the cart.
Purchase page Single destination
<script type="text/javascript">
var google_tag_params = {
flight_destid: "123",
flight_pagetype: "purchase",
flight_totalvalue: 120.00
};
</script>


Multiple destinations
<script type="text/javascript">
var google_tag_params = {
flight_destid: ["SFO", "SJC", "NYC", "LAX"],
flight_pagetype: "purchase",
flight_totalvalue: [120.00, 300.00, 500.00, 900.00]
};
</script>
The purchase confirmation page should also have all products that someone bought. In the "xxxxxxxx_totalvalue" parameter you need to send the sum of the values in the cart or on the conversion page.
All other pages <script type="text/javascript">
var google_tag_params = {
flight_destid: "",
flight_pagetype: "other",
flight_totalvalue:
};
</script>
On all other pages, use other for xxxxxxxx_pagetype.

Although there may not be any product or service information on these pages, AdWords can still pull products and services from your feed based on what is likely to perform the best.
Common errors when setting up custom parameters

Below are some of the common mistakes people make when they implement custom parameters using the example of an airline website. If you use Tag Assistant, you'll be able to identify most of these common mistakes.

1. String values are not quoted. For example:

<script type="text/javascript">
var google_tag_params = {
flight_destid: "234",
flight_pagetype: purchase,
flight_totalvalue: 120.99
};
</script>

Should be changed to:

<script type="text/javascript">
var google_tag_params = {
flight_destid: "234",
flight_pagetype: "purchase",
flight_totalvalue: 120.99
};
</script>

Single quotes also work, as long as they are used consistently.

2. Custom parameters are not separated by a comma (","). For example:

<script type="text/javascript">
var google_tag_params = {
flight_destid: "234"
flight_pagetype: "purchase"
flight_totalvalue: 120.99
};
</script>

Should be changed to:

<script type="text/javascript">
var google_tag_params = {
flight_destid: "234",
flight_pagetype: "purchase",
flight_totalvalue: 120.99
};
</script>

The last custom parameter doesn't need to have "," after it. But it's OK if it does.

3. Parameter contains space or non-ASCII characters. We only support [a-z][0-9] and '_'. For example:

<script type="text/javascript">
var google_tag_params = {
flight_destid: "234",
flight pagetype: "purchase",
flight_totalvalue: 120.99
};
</script>

Should be changed to:

<script type="text/javascript">
var google_tag_params = {
flight_destid: 234,
flight_pagetype: "purchase",
flight_totalvalue: 120.99
};
</script>

4. Multiple values in a parameter without brackets. For example:

<script type="text/javascript">
var google_tag_params = {
flight_destid: "123,"234",
flight_pagetype: "cart",
flight_totalvalue: 100,50
};
</script>

Should be changed to:

<script type="text/javascript">
var google_tag_params = {
flight_destid: ["123","234"],
flight_pagetype: "cart",
flight_totalvalue: [100,50]
};
</script>

5. Parameter with no value. For example:

<script type="text/javascript">
var google_tag_params = {
flight_destid: ,
flight_pagetype: "other",
flight_totalvalue:
};
</script>
Should be changed to:

<script type="text/javascript">
var google_tag_params = {
flight_destid: "",
flight_pagetype: "other",
flight_totalvalue: ""
};
</script>

or simply:

<script type="text/javascript">
var google_tag_params = {
flight_pagetype: "other"
};
</script>

6. Incorrect naming convention for custom parameters. For example:

<script type="text/javascript">
var google_tag_params = {
destid: "234",
pagetype: "purchase",
totalvalue: 120.99
};
</script>

Should be changed to:

<script type="text/javascript">
var google_tag_params = {
flight_destid: "234",
flight_pagetype: "purchase",
flight_totalvalue: 120.99
};
</script>

Alternative tag implementations

How to implement the non-JavaScript image tag (only use if the implementation above doesn't work)

We recommend using the JavaScript tag over the non-JavaScript image tag because it leads to fewer implementation errors and addresses several HTML goals. The non-JavaScript image tag is treated like an image. Since some web browsers cache images to speed up the time it takes for a page to load, the tag will only be activated the first time someone visits your website but not during subsequent visits. The JavaScript version of the tag fixes this.

You can use these instructions if you want to use the non-JavaScript part of the tag (also known as the image tag) or if you want to have a shorter version of the tag. The image tag doesn't require the JavaScript library (conversion.js) and the loading of the image happens in parallel with the page loading.

You need to customize the non-JavaScript portion of the remarketing tag so it can still send values. The data needs to be manually encoded.

Take the tag you've just created. The tag should look like this example:

<script type="text/javascript">
var google_tag_params = {
flight_destid: "REPLACE_WITH_STRING_VALUE",
flight_pagetype: "REPLACE_WITH_STRING_VALUE",
flight_totalvalue: REPLACE_WITH_NUMBER_VALUE
};
</script>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = XXXXXXXXXX;
var google_custom_params = window.google_tag_params;
var google_remarketing_only = true;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/XXXXXXXXXX/?value=0&amp;guid=ON&amp;script=0&amp;data.flight_destid=101&amp;
data.flight_destid=102
&amp;data.flight_pagetype=purchase"/>
</div>
</noscript>

The highlighted text is the non-JavaScript tag. Follow these steps to send your custom parameters through the remarketing tag:

1. Prepare the custom parameters (also called key/values) you'd like to send to AdWords. The key/values should be sent in the following format:

data.key1=val1&data.key2=val2&data.key2=val3...

For example, if you want to send flight_destid=100 and flight_pagetype=purchase as customer parameters, they should be arranged like this:

data.flight_destid=100&data.flight_pagetype=purchase

If a given key has multiple values, say multiple product or service ids on a shopping cart page, add another data.flight_destid= for each extra value.

data.flight_destid=101&data.flight_destid=102&data.flight_pagetype=cart

2. Append the string to pixel’s URL as parameters, and then HTML encode the & to &amp;

3. After the change, the final img src looks like this:

//googleads.g.doubleclick.net/pagead/viewthroughconversion/XXXXXXXXXX/?value=0&guid=ON&script=0&data.flight_destid=101&data.flight_destid=102
&data.flight_pagetype=purchase

4. Below is the final img tag, which you can put on your site. It gives you the same functionality as the JavaScript version of the tag.

<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/XXXXXXXXXX/?value=0&amp;guid=ON&amp;script=0&amp;data=flight_destid%3D101%2C102
%3Bflight_pagetype%3Dpurchase"/>
</div>

A note on ampersands (&): ampersands must be encoded as "&amp;" inside of HTML code (in the <img> src attribute), but not inside of JavaScript code. Many tags and containers that allow the piggybacking of pixels (like DoubleClick Floodlight) expect the URLs to not be HTML-encoded. This leads to frequent errors of double-encoding ampersands which leads to improper tracking. Make sure you use proper URL depending on the context. If you're unsure, use the Google Tag Assistant chrome extension to verify your implementation.