Clicky

  1. Home
  2. How To
  3. How to Add Google Analytics to AMP

How to Add Google Analytics to AMP

In today’s Blogging world publishing and understanding the audience is a heart to right articles and creating the royal readers. There should be KEY to understanding the behavior of the audience. So, AMP includes an amp-analytics element that allows publishers to track and view the behavior of visitors on the website. The publisher can automatically track visitor counts, Clicks, New Vs Returning and much more on AMP pages.

How to Add Analytics to AMP

Login to Google Analytics Account –> Go  to ‘Home‘ tab –> Copy Google Analytics Code

Login to WordPress Dashboard –> Navigate to AMP (This opens the AMP settings Panel) –>Settings -> Analytic  ->Enable “Google Analytics” option Paste the ID in Tracking ID Section –> Click on the “Save Changes” button.

That’s it; Now you can Track visitor counts, Clicks, New Vs Returning and much more on AMP pages.

Once you have added then you can also check that in your source code of the AMP pages like this screenshot.

How to Add Analytics to AMP (Video)

That’s it for this tutorial!

We hope it helped you. If you have any feedback or questions, then please share them in the comments section below.

Ask your Questions Directly!
If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!
Updated on February 14, 2020

    Are you still looking for a solution?

    Then fill out the below form and we will reach out to you within a few hours.

    Was this article helpful?

    Related Articles

    Comments

    1. any indication for it actually working?
      I mean the code is there- but tag assistant doesn’t see it.
      and there is a rumour going around duplicate content etc…
      where can i find additional info?

      1. Hi John,

        The Google Tag assistant does not detect the AMP pages because it does run with Javascript and AMP doesn’t allow it to do.

        But that doesn’t mean that its not working. It will still work perfectly.

        Regards,
        Ahmed

    2. Pingback: AMP - An Overview [Set-up, Pros & Cons] - The Digital Mind

    3. I added the official amp plugin. Is it a problem if I remove it and add your plugin?

      1. Hi Burhan,

        There is no problem if you remove the official amp plugin and add our plugin.

    4. I have my GA script added as this guide notes, but It’s not showing up on the site and the traffic is not being reported within GA. I’m also getting this error within Chrome console. Are these related? How can I fix this?

      Powered by AMP ⚡ HTML – Version 2001071857360 https://tap.fremontmotors.com/amp
      amp:1 Access to fetch at ‘https://www.googletagmanager.com/amp.json?id=GTM-K4WMZRG&__amp_source_origin=https%3A%2F%2Ftap.fremontmotors.com’ from origin ‘https://tap.fremontmotors.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
      http://www.googletagmanager.com/amp.json?id=GTM-K4WMZRG&__amp_source_origin=https%3A%2F%2Ftap.fremontmotors.com:1 Failed to load resource: net::ERR_FAILED
      log.js:252 [AmpAnalytics ] Error loading remote config: https://www.googletagmanager.com/amp.json?id=GTM-K4WMZRG Error: XHR Failed fetching (https://www.googletagmanager.com/…): Failed to fetch​​​
      at ab (log.js:715)
      at Xa.f.createExpectedError (log.js:364)
      at xhr-impl.js:111
      at async Promise.all (index 0)
      Za @ log.js:252
      log.js:252 [AmpAnalytics ] No request strings defined. Analytics data will not be sent from this page.
      Za @ log.js:252
      log.js:252 [AmpAnalytics ] Ignoring request for event. Request string not found: pageview

      1. Hi Infotel,

        It has been blocked by the CORS policy. Cors Policy allows on your server if you don’t know how to do this then contact your hosting company they will fix this issue.

    5. My AMP is no longer tracking GA on my mobile pages. I don’t know because the problem started after I updated the AMP plugin.

      1. Hi Offorma Miracle,

        Will you please provide us exact URL where you are having an issue so that we can check and fix it immediately.

    6. Based on Google’s help docs, you create a separate property for AMP pages. Does this follow that same advice or we use the same property for the traditional web property?

    Leave a Comment