Reputation: 1
can anyone help me to put google analytic code on amp story? Amp-story does not support GA code? I have put it like this.
<amp-analytics type="gtag" data-credentials="include">
<script type="application/json">
{
"vars" : {
"gtag_id": "G-XXXXXXXXXX",
"config" : {
"G-XXXXXXXXXX": { "groups": "default" }
}
}
}
</script>
</amp-analytics>
But it seems does not work.
Upvotes: 0
Views: 491
Reputation: 1
I have got the issue. Amp Story does not support Google Analytic 4 yet. If we use UA-XXXXXXX-X this code it works but G-XXXXXXXXXX does not work.
Upvotes: 0
Reputation: 21
Please add AMP analytic script first. Following is the google sample AMP snippet.
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<amp-analytics type="gtag" data-credentials="include">
<script type="application/json">
{
"vars" : {
"gtag_id": "<GA_MEASUREMENT_ID>",
"config" : {
"<GA_MEASUREMENT_ID>": { "groups": "default" }
}
}
}
</script>
</amp-analytics>
Also read following. https://developers.google.com/analytics/devguides/collection/amp-analytics
Upvotes: 1