How To Add Google Analytics To AMP Pages

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="//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

Author

  • Bharati Ahuja

    Bharati Ahuja is the Founder of WebPro Technologies LLP. She is also an SEO Trainer and Speaker, Blog Writer, and Web Presence Consultant, who first started optimizing websites in 2000. Since then, her knowledge about SEO has evolved along with the evolution of search on the web. Contributor to Search Engine Land, Search Engine Journal, Search Engine Watch, etc.

August 30, 2016
SEO Ahmedabad

Contact Info

802, Astron Tech Park, Satellite Road, Opp. Gulmohar Park Mall, Ahmedabad 380015, India

+91 9825025904
info@webpro.in

Daily: 9:00 am - 6:00 pm
Sunday: Closed

Copyright 2023 WebPro Technologies LLP ©  All Rights Reserved