You only need one <amp-analytics type="gtag">
tag on an AMP page to configure tracking for Google products. Learn more about the amp-analytics tag.
This section describes how to configure the <amp-analytics type="gtag">
tag if you use both Floodlight and Google Ads conversion tracking.
Global snippet
Here's an example of an <amp-analytics type="gtag">
global snippet on an AMP site that reports both Floodlight and Google Ads conversions:
<head>
<script async custom-element="amp-analytics"
src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
</head>
<body>
<!-- Google 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"
},
"AW-999999999":{
"groups": "default"
}
}
},
"triggers": {
}
}
</script>
</amp-analytics>
</body>
Notice the following fields in this <amp-analytics>
tag:
-
The
gtag_id
field contains the ID for a Search Ads 360 advertiser because Search Ads 360 was used to generate the tag in this example. You could use the ID provided by Google Ads conversion tracking instead.
You can specify the ID from any Google product that you're using on your AMP, but only use an ID from one Google product in the gtag_id field.
-
The
config
object contains a field for your Search Ads 360 advertiser ID and another field for your Google Ads conversion tracking ID.
Theconfig
object needs to contain one field for each Google product you're using to track activity on your AMP site.
Event snippet
On the page that you want to record your Floodlight activity, paste the event snippet you generated in Search Ads 360 into the triggers
object. If you're also recording a conversion for Google Ads, paste the Google Ads event snippet into the triggers
object as well. Here's a full example of the tag that needs to appear on the AMP conversion page to report both a Floodlight conversion and a Google Ads conversion:
<head>
<script async custom-element="amp-analytics"
src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
</head>
<body>
<!-- Google 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"
},
"AW-999999999":{
"groups": "default"
}
}
},
"triggers": {
"FC_i_KAdR-c7_4": {
"on": "visible",
"vars": {
"event_name": "conversion",
"send_to": "DC-3770326/actions/locat304+standard"
}
},
"a02yCPak-12345MMMMM": {
"on": "visible",
"vars": {
"event_name": "purchase",
"transaction_id": "",
"value": 15,
"currency": "USD",
"send_to": "AW-999999999/a02yCPak-12345MMMMM"
}
}
}
}
</script>
</amp-analytics>
</body>