Fix common formatting issues for custom parameters

To provide a comprehensive and consolidated view of your audiences and make audience management and optimisation simpler, you’ll find the following improvements in Google Ads:

  • New audience reporting
    Detailed reporting about audience demographics, segments and exclusions is now consolidated in one place. Click the Campaigns icon Campaigns icon and open the 'Audiences, keywords and content' tab and click Audiences. You can also easily manage your audiences from this report page. Learn more About audience reporting.
  • New terms
    We’re using new terms on your audience report and throughout Google Ads. For example, 'audience types' (these include custom, in-market and affinity) are now referred to as audience segments and 'remarketing' is now referred to as 'your data'. Learn more about the Updates to audience terms and phrases.

This article goes over how to format your custom parameters, and troubleshoot issues with how your tag was added to your site. It includes instructions on adding Javascript code and alternatives to your website, and common ways that code can get mixed up.

Before you begin

To get started using custom parameters, first read how to Tag your website for dynamic remarketing.

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 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 the proper URL depending on the context. If you're unsure, use the Google Tag Assistant chrome extension to verify your implementation.

Use Google Tag Manager

You can use Google Tag Manager instead of adding the dynamic remarketing tags to your site. This option routes the tagdata through a third party (Google).

Formatting custom parameters

  • For pages with multiple IDs like shopping basket 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, then 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 segments that Google Ads 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 will find information about the page type.

Although there may not be any product or service information on these pages, Google Ads 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.
Basket 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 basket page you should send all the items you have in the basket. 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 basket.
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 basket 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, Google Ads 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 that people make when they implement custom parameters using the example of an airline website. If you use Tag Assistant, then 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 fine 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: "0",
flight_pagetype: "other",
flight_totalvalue: 0
};
</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>

Using non-Javascript tags

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 that it takes for a page to load, the tag will only be activated the first time that 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 customise the non-JavaScript portion of the Google tag so it can still send values. The data needs to be manually encoded.

Take the tag that 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="//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 Google tag:

1. Prepare the custom parameters (also called key/values) that you'd like to send to Google Ads. 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 custom 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 basket page, add another data.flight_destid= for each extra value.

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

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&amp;data.flight_destid%3D101&data.flight_destid=102
&data.flight_pagetype=purchase

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

<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"/>

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
4093249199847682763
true
Search Help Centre
true
true
true
true
true
73067
false
false
false