Pyytämäsi sivu ei ole tällä hetkellä saatavilla kielelläsi. Voit valita toisen kielen sivun alaosasta tai pikakääntää minkä tahansa verkkosivun haluamallesi kielelle Google Chromen sisäänrakennetun käännösominaisuuden avulla.

Use the Google tag for Floodlight activities

To ensure that Campaign Manager 360 can measure your conversions effectively, we recommend that you use the Google tag (gtag.js) as the format for your Floodlight activity tags. Learn more about the Google tag and setting up your Google tag.

Make sure you enable Enhanced attribution when setting up your Floodlight configuration to see the benefits of improved conversion tracking for display and video inventory. Learn how to enable Enhanced attribution

Unsupported environments

  • The Google tag is not intended to work in mobile apps. Learn more about options for using Floodlight with apps.
  • Campaign Manager 360 does not support Accelerated Mobile Pages (AMP). You should continue to follow the existing process for using Floodlight with AMP.
  • The Google tag won’t fire in browsers that don’t support JavaScript. The tag includes a <noscript> section that will load if JavaScript isn’t supported. Learn more below.

Passing data to fields in the Google tag

If you’re migrating from iframe or image tags to the Google tag, see our retagging guide to learn more about how parameters from these tags map to fields in the Google tag.

Fields in the global snippet

The global snippet loads the Google tag’s tracking library and configures the accounts where the tag sends data.

Let’s take a closer look at some key fields in the global snippet:

  • src="https://www.googletagmanager.com/gtag/js?id=DC-[floodlightConfigID]"
    This section shows an identifier for the account where the tag was originally generated. When you’re generating tags from Campaign Manager 360, this is your Floodlight configuration ID.

  • gtag('config', 'DC-[floodlightConfigID]')
    The config command shows the specific accounts associated with the Google tag. When you’re generating tags from Campaign Manager 360, this is your Floodlight configuration ID.

If you’re using the Google tag with multiple Floodlight configurations or Google products, you may see multiple config commands and differing IDs in the src= string. See the section below for more details.

You should not dynamically pass data into the fields in the global snippet. Once it’s installed on your site with the correct account identifiers, the global snippet is complete.

Fields in the event snippet - overview

The event snippet is specific to each Floodlight activity and the corresponding event it’s tracking. Some fields are common to all event snippets, while other fields depend on the settings of the Floodlight activity associated with the tag.

You’ll need to dynamically pass data to fields in the event snippet. Here’s an overview of the key fields in event snippets and the tag types they apply to. See the sections below for more detailed information about each field.

Field name Value format Tag type and counting method Overview
allow_custom_scripts Boolean All Enables dynamic tags.
u1, u2, etc. String All Indicates custom Floodlight variables.
send_to String All Maps routing identifiers for the Floodlight configuration, activity group, activity tag, and counting method.
session_id String Counter - per session Sets a unique identifier for each session.
value Number All sales Passes the revenue generated by a transaction.
transaction_id Number All sales Sets a unique identifier for a transaction.
quantity Number Sales - items sold Contains the number of items sold during a transaction.

Fields in all event snippets

The following fields appear in all event snippets generated by Campaign Manager 360:

  • 'allow_custom_scripts': true
    This field enables dynamic Floodlight tags, which allows you to integrate third-party tools with your tag. It must be set to true for dynamic tags to work. We recommend using the settings on your Floodlight activity to enable dynamic tags when you’re first creating an activity. The value of this field, however, will override the settings for dynamic tags on the associated Floodlight activity in Campaign Manager 360. If you don’t want your event snippet to support dynamic tags, set this field to false or remove it entirely from your event snippet.

  • 'send_to': 'DC-[floodlightConfigID]/[activityGroupTagString]/[activityTagString]+[countingMethod]'
    The send_to field contains routing identifiers for the Floodlight configuration, activity group, activity tag, and counting method.

    • DC-[floodlightConfigID]
      This field identifies the Floodlight configuration the tag is associated with. It corresponds to the src= parameter in iframe and image tags.

    • [activityGroupTagString]
      This field identifies the Floodlight activity group the tag is associated with. You can set your own value or use the default value. The default value is based on the first five letters of the activity group name, plus a string of three random alphanumeric characters, underscores, and dashes. (If the activity group name has fewer than five characters, extra letters are appended before the alphanumeric characters so that there are still eight characters.) The value is case sensitive. This corresponds to the type= parameter in iframe and image tags.

    • [activityTagString]
      This identifies the Floodlight activity the tag is associated with. You can set your own value or use the default value. The default value is based on the first five letters of the activity name, plus a string of three random alphanumeric characters, underscores, and dashes. (If the activity name has fewer than five characters, extra letters are appended before the alphanumeric characters so that there are still eight characters.) The value is case sensitive. This corresponds to the cat= parameter in iframe and image tags.

  • 'u1': '[variable]'
    Custom Floodlight variables can accept any values that you choose to pass to them. You can use these values to build audience lists. You must not pass any data that Google Marketing Platform could use or recognize as personally-identifiable information. Learn more

Fields in event snippets for counter tags

Counter tags count the number of conversions associated with an event. Depending on how you set up your activity, counter tags count every conversion event, or they limit the counting so that each user is only counted as converting once per day or per user session. There’s one field specific to counter tags:

  • 'session_id': '[SessionID]'
    Use this field to insert a unique session ID if you’re using counter tags with a per session counting methodology. The session ID tells Campaign Manager 360 to count only one event per session on your site. It's up to you to decide how a session is defined. For example, a session could begin when a user signs in to your site and end when the session times out. This corresponds to the ord= parameter in iframe and image tags.

Example event snippet for counter - standard activities

<!-- 
Event snippet for Activity Name on http://foo.com: Please do not remove.
Place this snippet on pages with events you’re tracking.
Creation date: 10/30/2017
-->
<script>
  gtag('event', 'conversion', {
    'allow_custom_scripts': true,
    'send_to': 'DC-[floodlightConfigID]/[activityGroupTagString]/[activityTagString]+standard'
  });
</script>
<noscript>
<img src="https://ad.doubleclick.net/ddm/activity/src=[floodlightConfigID];type=[activityGroupTagString];cat=[activityTagString];ord=1?" width="1" height="1" alt=""/>
</noscript>
<!-- End of event snippet: Please do not remove -->

Example event snippet for counter - unique activities

<!-- 
Event snippet for Activity Name on http://foo.com: Please do not remove.
Place this snippet on pages with events you’re tracking.
Creation date: 10/30/2017
-->
<script>
  gtag('event', 'conversion', {
    'allow_custom_scripts': true,
    'send_to': 'DC-[floodlightConfigID]/[activityGroupTagString]/[activityTagString]+unique'
  });
</script>
<noscript>
<img src="https://ad.doubleclick.net/ddm/activity/src=[floodlightConfigID];type=[activityGroupTagString];cat=[activityTagString];ord=1;num=1?" width="1" height="1" alt=""/>
</noscript>
<!-- End of event snippet: Please do not remove -->

Example event snippet for counter - per session activities

<!-- 
Event snippet for Activity Name on http://foo.com: Please do not remove.
Place this snippet on pages with events you’re tracking.
Creation date: 10/30/2017
-->
<script>
  gtag('event', 'conversion', {
    'allow_custom_scripts': true,
    'session_id': '[SessionID]',
    'send_to': 'DC-[floodlightConfigID]/[activityGroupTagString]/[activityTagString]+per_session'
  });
</script>
<noscript>
<img src="https://ad.doubleclick.net/ddm/activity/src=[floodlightConfigID];type=[activityGroupTagString];cat=[activityTagString];ord=[SessionID]" width="1" height="1" alt=""/>
</noscript>
<!-- End of event snippet: Please do not remove -->

Fields in event snippets for sales tags

Sales tags are usually placed on the confirmation page following a sale, with information about the sale passed to the tag. There are a few fields specific to sales tags:

  • 'value': '[Revenue]'
    Use this field to pass the revenue generated by a transaction—in other words, the purchase price of the items in the sale. In most cases, the value is the revenue generated, not the total purchase price, which might include sales tax, VAT, or shipping costs. The field accepts numbers without commas or currency symbols; you can use a decimal point (.) if desired. This corresponds to the cost= parameter in iframe and image tags.

  • 'transaction_id': '[OrderID]'
    Use this field to insert a unique numerical identifier for each transaction. The order IDs are included in the Path to Conversion (P2C) report. This corresponds to the ord= parameter in iframe and image tags.

  • 'quantity': '[Quantity]'
    Use this field to pass the number of items sold during a transaction:

    If you're counting each transaction as a single conversion, the value is 1.

    If you're counting each item sold during a single transaction as a separate conversion, insert the number of items sold as part of each transaction as the value.

    The value must be an integer greater than zero. Campaign Manager 360 multiplies the value by the number of conversion events to get the number of conversions for the sales tag. If the value is zero, or the field contains a non-numeric value, no conversions will be counted.

Example event snippet for sales - transaction activities

<!-- 
Event snippet for Activity Name on http://foo.com: Please do not remove.
Place this snippet on pages with events you’re tracking.
Creation date: 10/30/2017
-->
<script>
  gtag('event', 'purchase', {
    'allow_custom_scripts': true,
    'value': '[Revenue]',
    'transaction_id': '[OrderID]',
    'send_to': 'DC-[floodlightConfigID]/[activityGroupTagString]/[activityTagString]+transactions'
  });
</script>
<noscript>
<img src="https://ad.doubleclick.net/ddm/activity/src=[floodlightConfigID];type=[activityGroupTagString];cat=[activityTagString];qty=1;cost=[Revenue];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=[OrderID]" width="1" height="1" alt=""/>
</noscript>
<!-- End of event snippet: Please do not remove -->

Example event snippet for sales - items sold activities

<!-- 
Event snippet for Activity Name on http://foo.com: Please do not remove.
Place this snippet on pages with events you’re tracking.
Creation date: 10/30/2017
-->
<script>
  gtag('event', 'purchase', {
    'allow_custom_scripts': true,
    'value': '[Revenue]',
    'transaction_id': '[OrderID]',
    'quantity': '[Quantity]',
    'send_to': 'DC-[floodlightConfigID]/[activityGroupTagString]/[activityTagString]+items_sold'
  });
</script>
<noscript>
<img src="https://ad.doubleclick.net/ddm/activity/src=[floodlightConfigID];type=[activityGroupTagString];cat=[activityTagString];qty=[Quantity];cost=[Revenue];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=[OrderID]?" width="1" height="1" alt=""/>
</noscript>
<!-- End of event snippet: Please do not remove -->
 

Fields in event snippets for enhanced conversions

Enhanced conversions supplement your existing conversion tags by sending hashed, first-party conversion data from your website in a privacy-safe way. Learn more about allowing enhanced conversions.

The user_data variable is unique to event snippets with enhanced conversions. 

‘user_data’: {

   ‘email’: ‘[Email]’

   ‘phone_number’: [PhoneNumber]’,

   ‘address’: {

         ‘first_name’: ‘[FirstName]’,

         ‘last_name’: ‘[LastName]’ ,

         ‘street’: {Street]’,

         ‘city’: ‘[City]’,

         ‘region’: ‘[Region]’,

         ‘postal_code’: ‘[PostalCode]’,

         ‘country’: ‘[Country]’

}
Use this field to pass the user’s email, phone number, and address from your webpage. 
Custom fields

You can insert custom data into event snippets with the dc_custom_params field.

This field accepts any values you want to pass to Google Marketing Platform. You must not pass any data that Google Marketing Platform could use or recognize as personally-identifiable information. Here are some common fields you may want to use with dc_custom_params field:

Field name Value format Counting method Description
ord Number All The Google tag will automatically handle cache busting for you. If you choose to override this and control cache busting manually, you can use the ord field. Add a value to the ord field based on the tag type and counting method the same way you would for an iframe tag.
num Number Counter - unique The Google tag will automatically handle cache busting for you. If you choose to override this and control cache busting manually, you can use the num field. Add a value to the num field the same way you would for an iframe tag.
dc_lat 0 or 1 All This field applies to tags on mobile devices. It accepts a value of 0 or 1. A value of 1 means that the user has enabled the “Limit Ad Tracking” option for IDFA or AdID in order to opt out of interest-based ads and remarketing. If "Limit Ad Tracking" is off, the value is 0. If missing or unpopulated, this field will default to 0.
tag_for_child_directed_treatment 0 or 1 All This field applies to tags on mobile devices. It accepts a value of 0 or 1. A value of 1 indicates that this particular request may come from a user under the age of 13, under COPPA compliance.
tfua 0 or 1 All It accepts a value of 0 or 1. A value of 1 indicates that this particular request may come from a user under the age of 16 (may differ by country), under compliance with the EU’s General Data Protection Regulation (GDPR) or other regulations.
npa 0 or 1 All It accepts a value of 0 or 1. A value of 1 indicates that this particular request may come from a user who wishes to opt-out of remarketing. If missing or unpopulated, this field will default to 0.
match_id string all

A unique advertiser created identifier (passed via Floodlight) that can be synced with Google to attribute offline conversions.

  • Match ID has a limit of 100 characters and is case sensitive.
  • Match ID can only contain letters, numbers, underscores, hyphens and periods.
 

Example event snippet with the dc_custom_params field

<!-- 
Event snippet for Activity Name on http://foo.com: Please do not remove.
Place this snippet on pages with events you’re tracking. 
Creation date: 10/30/2017
-->
<script>
  gtag('event', 'purchase', {
    'allow_custom_scripts': true,
    'value': '[Revenue]',
    'transaction_id': '[OrderID]',
    'send_to': 'DC-[floodlightConfigID]/[activityGroupTagString]/[activityTagString]+[countingMethod]',
    'dc_custom_params': {
      'ord': '1',
      'num': '1234',
      'dc_lat': '1',
      'tag_for_child_directed_treatment': '0',
      'tfua': '1',
      'npa': '1',
      'match_id':[your_match_id],
    }
  });
</script>
<noscript>
<img src="https://ad.doubleclick.net/ddm/activity/src=[floodlightConfigID];type=[activityGroupTagString];cat=[activityTagString];qty=1;cost=[Revenue];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord=[OrderID]?" width="1" height="1" alt=""/>
</noscript>
<!-- End of event snippet: Please do not remove -->

<noscript> section of event snippets

All event snippets contain a <noscript> section. This is used if a browser doesn’t support JavaScript and the main section of the Google tag can’t be used. In that case, an image tag will be used instead.

Make sure that you’re populating the parameters in the <noscript> section just like an image tag. The values in these parameters should match the values for the equivalent parameters in the <script> section of the tag.

Adapt an existing Google tag for multiple Floodlight configurations or Google products

If you already have a Google tag, you can configure it to send data to multiple Google products by:

  • Updating the global snippet to include identifiers for each product.
  • Using separate event snippets for each product.

Example adapted Google tag

Let’s use an example of a Google tag originally generated from a Google Analytics account. The global snippet would look like this:

<!-- Google Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>

<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments)};
  gtag('js', new Date());

  gtag('config', 'GA_TRACKING_ID');
</script>

To add support for your Floodlight configuration, you don’t need to add a second global snippet to your site. Just add the highlighted config command to your existing global snippet:

<!-- Google Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script><script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments)};
  gtag('js', new Date());

  gtag('config', 'GA_TRACKING_ID');
  gtag('config', 'DC-1234567');
</script>

For each additional Google product you want your tag to support, add a new config command with the right account identifier.

Note that the identifier in the src= part of the tag is set when you first generate a Google tag. It doesn’t determine which accounts will receive data from the tag. In the example above, the tag was originally generated from Analytics, so the src= contains an Analytics ID. Which accounts receive data from the Google tag is determined by the config command and by using event snippets specific to each product with a send_to field that routes to that product.

Frequently asked questions

Do I need to set up cache busting with the Google tag?

No. The Google tag will automatically handle cache busting for you. Learn more

Why is the Google tag placed in the <head> when iframe and image tags were placed in the <body> of my site?

Unlike iframe and image tags, the Google tag is an asynchronous tagging library. This means that a browser will download the tag without blocking the rendering of your page’s content, so you can place the tag at the top of your site between the <head> tags.

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

Search
Clear search
Close search
Main menu
14079528531825124901
true
Search Help Center
true
true
true
true
true
69192
false
false