It is super easy to setup google analytics on the AMP wordpress plugin.
It is very important to remember that AMP pages cannot contain javascript code. Aim for speed.
- Install the AMP plugin
- Setup theme, page and logo
- Suppress all plugins for speed
- Install the analytics code
You can install the code in your plugin.
Copy and paste the following code
{
"vars": {
"account": "UA-xxxxxx-x"
},
"triggers": {
"trackPageview": {
"on": "visible",
"request": "pageview"
}
}
}
Note: You must enter the Type: googleanalytics. If you leave it blank, analytics tracking will not work.
After this you will see pages with ?amp=1 will appear
More information on how to add code to your AMP pages is available here
