Report Floodlight conversions in AMP pages

Technical details of amp-analytics tag for Search Ads 360

To report Floodlight conversions from an AMP page, you configure the <amp-analytics type="gtag"> tag to send data about the conversion to Google. 

This article describes the syntax of the configuration object your AMP page needs to contain, along with required and optional data that can be in the configuration object.

Global snippet

Here's an example of the <amp-analytics type="gtag"> tag that should be placed between the <body> and </body> tags on every page of your AMP site. Note that to enable the <amp-analytics> tag, you also need to add a <script> tag between <head> and </head> tags on every page of your AMP site.

<head>
  <script async custom-element="amp-analytics"
    src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
</head>

<body>

<!-- Global site tag (gtag) - Google Marketing Platform: 3770326 -->
  <amp-analytics type="gtag" data-credentials="include">
    <script type="application/json">
    {
      "vars": {
        "gtag_id": "DC-3770326",
        "config": {
          "DC-3770326": {

           "groups": "default"
          }

        }
      },
      "triggers": {
      }
    }   

    </script>
  </amp-analytics>

</body>

Let’s take a closer look at the key attributes and fields in the <amp-analytics> tag:

  • amp-analytics type="gtag" data-credentials="include": In the tag declaration,  type="gtag" identifies Google as the vendor and will cause the tag to send its data to Google. Google will interpret the tag as global site tag on an AMP page.

    The data-credentials="include" attribute turns on the ability to read and write cookies

  • gtag_id: Shows an identifier for the account where the tag was originally generated.
    When you generate tags from Search Ads 360 or Campaign Manager, this is "DC-" followed by your Floodlight configuration ID.

    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 Floodlight ID field.

    If you’re using this tag with multiple Google products, gtag_id may show an identifier for a different product, such as Google Analytics. In this case, just leave the other product"s ID in the gtag_id field and specify a Floodlight configuration ID in the config object.

  • config: Identifies the Floodlight configuration that the tag is associated with.
    If you generate the tag from Search Ads 360 or Campaign Manager, this will be the same value that appears in the gtag_id field.

    If you’re using this tag with multiple Floodlight configurations or Google products, your site"s <amp-analytics> tag will already have a config object. In this case, just add this advertiser"s Floodlight ID to the existing config object on every page of your site. Learn more

Event snippet

To demonstrate the full capabilities of using <amp-analytics> to report Floodlight conversions, the following tag contains an event snippet for a transaction activity. It also contains the tfua Floodlight custom field.

This tag should be placed between the <body> and </body> tags on the page with the transaction you’re tracking. 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].

<head>
  <script async custom-element="amp-analytics"
    src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
</head>

<body>
  <amp-analytics type="gtag" data-credentials="include">
    <script type="application/json">

     {
      "vars": {
        "gtag_id": "DC-3770326",
        "config": {
          "DC-3770326": {}
        }
      },
      "triggers": {
        "FC_i_KAdR-c7_4": {
          "on": "visible",
          "vars": {
            "event_name": "purchase",
            "value": "[Revenue]",
            "transaction_id": "[Order ID]",
            "send_to": [
              "DC-3770326/1sale326/bensr0+transactions"
            ],
            "dc_custom_params": {
              "tfua": "1"
            }
          }
        }
      }
    }
  </script>
  </amp-analytics>
</body>

Let’s take a closer look at the key fields in the triggers object:

  • Trigger name: A unique name for the trigger. When you use Search Ads 360 to generate an amp-analytics tag, Search Ads 360 creates a unique string for this field. 
  • "event_name": "conversion" or "purchase"
    Specifies the type of Floodlight activity the snippet is recording. For Floodlight action activities, specify conversion. For transaction activities, specify purchase.
  • "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 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.

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 global site 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 global site 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.
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).
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.
Was this helpful?
How can we improve it?