Hello friends, Today I worked on fixing google analytics problems in AMP pages in a wordpress Blog Website. I found some major problems during making analytics for AMP pages. If don’t know about AMP please refer to below link for adding google analytics to amp pages

WHAT IS AMP?

 

I was working with AMP wordpress plugin and my google webmaster was showing some errors which i needed to fix. Also this plugin doesn’t allows us to add GA(Google Analytics) codes to AMP pages.

Open the /plugins/amp/templates/single.php

  1. Add amp javascript to the header

<script async custom-element=”amp-analytics” src=”https://cdn.ampproject.org/v0/amp-analytics-0.1.js”></script>

2. Add below analytics data to page..Put the code just after BODY tag.

 

Now For amp page testing please check here

https://search.google.com/search-console/amp

Leave a Reply