Video: Adding Google analytics for your AMP content

AMP Analytics

There are various methods of adding Analytics to your AMP pages, but in this tutorial we are going to use the official WordPress AMP Plugin, which makes the process easy. You can follow the steps below to ensure your AMP pages are being tracked correctly.

  • Tip: It is recommended that you create a new property code in your Google Analytics account specific for your AMP website if you are using “Transitional / Paired” or “Reader / Classic” mode. Otherwise your AMP URLs will be added alongside your standard non AMP urls.
  1. Open up your WordPress dashboard
  2. Hover over the “AMP” tab and click on “Analytics” ( See image)
  3. Next you will need to add a new analytics vendor/provider. In this case we are using Google Analytics, so you will need to add the correct tag associated with Google Analytics, which is googleanalytics. Scroll down to the “Add new entry” text and input googleanalytics into the “Type” field. ( See image)
    If you wish to use another vendor other than Google analytics you can see a list of all supported vendors here.
  4. Now copy the provided sample code including all the brackets from just above the “Add new entry” title. ( See image)
  5. Paste the code into the “JSON Configuration” field. ( See image)
  6. Replace the “UA-XXXXX-Y” text with your own Property Tracking ID, keeping your own Property Tracking ID within the quotes. You will get your Property Tracking ID from within your Google Analytics account after your add a new property for your AMP site (or use your existing non AMP property) ( See image)
  7. Press “Save”. If there are any errors then the system will output an error and it won’t allow you to save. ( see image). If you have added Analytics correctly you should see a “The analytics entry was successfully saved!” notice. ( see image)

You now have Google Analytics setup and ready to go for your AMP URLs. As mentioned it’s best practise to use a new Property Tracking ID within your Analytics for your AMP pages if using “Transitional / Paired” or “Reader / Classic” mode, but not essential. If you choose to use the same Property Tracking ID as your non AMP site you will simply see all your AMP URLs alongside your non AMP URLs in your Analytics dashboard. You can distinguish your AMP from non AMP easily, as you will see the full URLs showing your AMP pages with a /?amp or /amp suffix.

You can also use the below report which allows you to easily compare your AMP vs non AMP traffic.
Performance Metrics – AMP vs non AMP


See some related links also to various supporting documentation.