Method 1
Install Glue For Yoast SEO & AMP plugin.
Not only does this plugin gives you the ability to add GA tracking to your AMPs, but it also enables you to customize the look of your accelerated mobile pages, at least to some extent.
As soon as you install the plugin, navigate to its settings and click on the ‘Analytics’ tab.
Please note: generic GA scripts will not work with the AMP framework, so you will have to add an AMP-specific JSON version of your GA script.
Simply add the following lines to the tracking field in Yoast Glue AMP analytics. Ensure to replace a default tracking ID with your unique ID.
<amp-analytics type=”googleanalytics”>
<script type=”application/json”>
{
“vars”: {
“account”: “UA-XXXXX-Y” – Replace this with your tracking code
},
“triggers”: {
“trackPageview”: {
“on”: “visible”,
“request”: “pageview”
}
}
}
</script>
</amp-analytics>
It’s worth noting that this method may not work for everyone. To troubleshoot your GA installation using this approach, open up one of your accelerated mobile pages, navigate to Google Analytics and check real-time sessions. If you see live traffic, your GA script has been installed correctly.
Otherwise, if you don’t see any live sessions, it’s likely that this method hasn’t worked for you. In this case, you will need to follow the method below.
Read more –
How to Setup Google AMP Webpages with Google Analytics Tracking
0 responses on "How can I generate tags for amp google analytics?"