Use the Google tag

Technical details for Google tag and event snippet

The Google tag streamlines tagging across Google’s site measurement, conversion tracking, and remarketing products. To record a Floodlight conversion, a Google tag contains two code snippets – a global snippet that you install on every page of your site, and a Floodlight event snippet that you install on the conversion page.

When you create a Floodlight activity, Search Ads 360 automatically generates a global snippet and an event snippet. This article describes the fields in the snippets Search Ads 360 generates.

Note: if you create Floodlight activities from Campaign Manager 360, you may see additional fields or different values.

Global snippet

Accelerated mobile pages require a different tag from desktop and conventional mobile pages. Determine which tag your page is configured for before deploying the tag.

For non-accelerated mobile pages

Here's an example of the global snippet for non-accelerated mobile pages. This snippet should be placed between the <head> and </head> tags on every page of your site.

<!-- 
Start of global snippet: Please do not remove
Place this snippet between the <head> and </head> tags on every page of your site.
-->
<!-- Google tag (gtag.js) - DoubleClick -->
<script async src="https://googletagmanager.com/gtag/js?id=DC-1234567"></script>
<script>
 window.dataLayer = window.dataLayer || [];
 function gtag(){dataLayer.push(arguments)};
 gtag('js', new Date());

 gtag('config', 'DC-1234567');
</script>
<!-- End of global snippet: Please do not remove -->

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

  • src="https://googletagmanager.com/gtag/js?id=DCM_FLOODLIGHT_CONFIG_ID"
    Shows an identifier for the account where the tag was originally generated. When you generating tags from Search Ads 360 or Campaign Manager 360, this is your Floodlight configuration ID.

  • gtag('config', 'DCM_FLOODLIGHT_CONFIG_ID');
    The config command identifies the Floodlight configuration that the tag is associated with. To see this ID in Search Ads 360:

    1. In the left navigation pane, click Advertiser settings.
    2. On the Advertiser settings tab, the Floodlight ID appears in the Campaign Manager 360 Floodlight ID field.

    If you’re using the Google tag with multiple Floodlight configurations or Google products, your site will already have a global snippet with config commands. In this case, just add this advertiser's config command to the existing global snippet on every page of your site. Learn more about using the Google tag for Floodlight conversion tracking.

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. 

For accelerated mobile pages

Here's an example of the global snippet for accelerated mobile pages. This snippet should be placed between the <head> and </head> tags on every page of your site.

 

<!-- Google tag (gtag) -->
<amp-analytics type="gtag" data-credentials="include">
<script type="application/json">
{
 "configRewriter": {
   "varGroups": {
     "dns": {"enabled": true}
  }
 },
 "vars": {
   "gtag_id": "DC-1234567",
   "config": {
     "DC-1234567": {
       "groups": "default",
       "dc_natural_search": {
        "exclusion_parameters": [
          "^foo[_]bar=qux$",
          "^yes=no^"
        ],
        "engines": {
          "aol": "1;2;a",
          "ask": "3;4;b",
          "google": "5;6;c",
          "msn": "7;8;d",
          "yahoo": "9;0;e",
          "yahoo_japan": "11;12;f"
        }
       }
     }
   }
 },
 "triggers": {
 }
}
</script>
</amp-analytics>

Let's take a closer look at the key fields in the Google tag:

  • configRewriter
    This field indicates whether the page is configured for reporting on natural search results.
  • dc_natural_search
    This field contains the exclusion parameter, and list of engines to target.

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

Event snippet

Here's an example of an event snippet Search Ads 360 has generated for a transaction activity. The event snippet should be placed on pages with events you’re tracking. It can be placed anywhere on the page after the global snippet, but we recommend placing it within the <head> section for the best tracking accuracy.

You'll need to dynamically set values for some of these fields, using data from the conversion that's being recorded. In the example below, the placeholders for dynamic values appear in brackets, like this: [Revenue].

<!--
Event snippet for Thank You on http://example.com/thanks: Please do not remove.
Place this snippet on pages with events you’re tracking. 
Creation date: 11/01/2017
-->
<script>
 gtag('event', 'purchase', {
   'allow_custom_scripts': true,
   'value': '[Revenue]',
   'transaction_id': '[Order ID]',
   'send_to': 'DC-1234567/group1/thank123+transactions',
   'u1': '[Custom Floodlight variable]'
 });
</script>
<noscript>
<img src="https://ad.doubleclick.net/ddm/activity/src=1234567;type=group1;cat=thank123;
qty=1;cost=[Revenue];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;
ord=[Order ID]?" width="1" height="1" alt="">
</noscript>
<!-- End of event snippet: Please do not remove -->

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

  • 'allow_custom_scripts' : true
    Enables dynamic Floodlight tags. All activities created in Search Ads 360 generate dynamic tags, and this field must be set to true for dynamic tags to work correctly.
  • 'value': '[Revenue]'
    For transaction event snippets only. The amount of revenue generated by a conversion—in other words, the purchase price of the items in the sale. In most cases, the relevant value is the revenue generated, not the total purchase price, which might include sales tax, VAT, shipping costs, or other costs.

    Specify a number without commas or currency symbols. You can use a decimal point (.) if desired.
  • 'transaction_id': '[Order ID]'
    For transaction event snippets only. A unique identifier that you dynamically generate for each transaction. The order ID must be a number greater than zero.

    Order IDs are included in the Path to Conversion (P2C) report in Report Builder.

  • 'send_to' : 'DC-[floodlightConfigID]/[activityGroupTagString]/[activityTagString]+[countingMethod]'
    Identifies the Floodlight activity associated with this tag, along with the counting method.

    • [floodlightConfigID]: identifies the Floodlight configuration that the event snippet is associated with. This is the same value that appears in the global snippet's 'config' command.

    • [activityGroupTagString]/[activityTagString]: identifies the activity and activity group. Search Ads 360 generates these strings when you create an activity group and activity. To see these strings in Search Ads 360:

      1. In the left navigation pane, click Advertiser settings.
      2. Click the Floodlight▼ tab and select Floodlight activities.
      3. The reporting table includes an Activity tag string column and an Floodlight activity group tag string column.
        In the table row that lists a Floodlight activity, the values in these columns will match the values in the send_to command in the activity's event snippet.
    • [countingMethod]: specifies how the activity counts conversions. Event snippets generated from Search Ads 360 specify one of the following counting methods:

      Event snippets generated in Campaign Manager 360 might specify other counting methods.

      • Standard counts every conversion by every user. This is the counting method for action activities generated in Search Ads 360.
      • Transactions counts the number of transactions that take place, and the cost of each transaction. For example, if a user visits your website and buys five books for a total of €100, one conversion is recorded with that monetary value. This is the counting method for transaction activities generated in Search Ads 360.
    • 'u1': '[Custom Floodlight variable]'
      Custom Floodlight variables can accept any values that you choose to pass to them. You can use these values as metrics or dimensions and segments in Search Ads 360. You must not pass any data that Search Ads 360 could use or recognize as personally-identifiable information.

Custom fields in the event snippet

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

Event snippets generated by Search Ads 360 include an optional <noscript> tag that contains a Floodlight image tag. This tag is used to report conversions in browsers that don't support JavaScript. If you use Floodlight iframe or image tags, we recommend you migrate to the Google tag or use Google Tag Manager with the Conversion Linker to measure conversions more accurately and benefit from the latest dynamic features and integrations as they become available.

More information for website developers

For more information about adding the Google tag (gtag) to your site, see gtag.js Developer Guide.

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

Search
Clear search
Close search
Google apps
Main menu
10465276959360888509
true
Search Help Center
true
true
true
true
true
5055977
true
false