Analytics with AMP Cache
-
Hello,
I have been trying to read through the AMP documentation from Google. However, it’s a bit over my head.
I have two questions:
Firstly, does the analytics code also work for pages served by the Google cache? The code I am using is the code provided by the AMP plugin:
{
“vars”: {
“account”: “UA-XXXXX-Y”
},
“triggers”: {
“trackPageview”: {
“on”: “visible”,
“request”: “pageview”
}
}
}Secondly, what is the difference between how the above code works and how the code provided on the developers.google page works?
{
“vars” : {
“gtag_id”: “<GA_MEASUREMENT_ID>”,
“config” : {
“<GA_MEASUREMENT_ID>”: { “groups”: “default” }
}
}
}I initially was using the second code and I thought that my AMP pages weren’t being tracked. Google analytics was not showing any /amp pages. However, when I changed the code to the first code, /amp pages started showing up in analytics. However, my traffic shown is now much lower.
Is it possible that the second code (which I was initially using) was counting AMP pages, but that they were showing as their canonical versions rather than the /AMP versions?
I am sorry if this is the wrong place to ask. However, I am very confused!
The page I need help with: [log in to see the link]
The topic ‘Analytics with AMP Cache’ is closed to new replies.