How To Add Google Analytics To AMP Pages


August 30th, 2016

AMP Pages are the future for mobile search results. Google has announced recently that they will be removing “mobile-friendly” labels from search results and they also announced that they are testing to show AMP pages with a AMP icon  in the search results.

AMP-Preview-Results

Hence, soon the AMP pages will move out from the Top Stories section and will be a part of the SERPs. Considering how the mobile usage is exponentially increasing ,  making your site AMP compliant and tracking its performance is a necessity.

In order to add Google analytics to the AMP Pages,  include the following script in the <head>, before the AMP JS library:

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

Add the amp-analytics element to the body of your page. Then to enable the built-in support for Google Analytics, set the type attribute of the amp-analytics element to ‘googleanalytics’. It is recommended to include an id attribute so that you can easily identify each amp-analytics element (e.g. debugging).

<amp-analytics type=”googleanalytics” id=”analytics1″>
  …
</amp-analytics>
Note: It is recommended that you set up and use a separate property for AMP measurement.

Some other vendors offering Analytics For AMP Pages are:

  1. Adobe Analytics – marketing.adobe.com
  2. AFS Analytics  – afsanalytics.com
  3. AT Internet  – developers.atinternet-solutions.com
  4. Chartbeat – support.chartbeat.com
  5. Clicky Web Analytics – clicky.com
  6. Cxense –  wiki.cxense.com
  7. Google Analytics –  developers.google.com
  8. INFOnline / IVW –  www.infonline.de
  9. Krux –  help.krux.com
  10. Linkpulse –  docs.linkpulse.com
  11. Lotame –  mylotame.force.com
  12. mParticle – docs.mparticle.com
  13. Parsely –  parsely.com/docs
  14. Piano –  vx.piano.io
  15. Quantcast Measurement –  quantcast.com

Validation

To check if the analytics code is correctly added one can validate the AMP pages  on https://validator.ampproject.org/

 

Related Posts On AMP:

What Is AMP? All About Accelerated Mobile Pages By Google

AMP Pages To Be Shown In Main Google Search Results – Preview The Experience

Google To Remove Mobile-Friendly Labels and Keep Check On Interstitials For A Better Mobile Search Experience

About The Author

Founder of WebPro Technologies a Web solutions company based in India which focuses on building quality web presence for businesses. Bharati Ahuja is a SEO Trainer and speaker, Web Entrepreneur, Blog Writer, Internet Marketing Consultant.

Website: http://www.webpro.in/about-bharati-ahuja/

Digital Marketing Agency India