How to add Google Analytics to AMP pages on WordPress

 

Accelerated Mobile Pages (AMP) is a platform used to build web pages for static content that renders fast. AMP includes an element that enables measurement of user interactions, and it has built-in support for Google Analytics.

If you don’t add Google Analytics tracking to your AMP pages, you will be missing key analytics data about your AMP driven traffic. Since you won’t be tracking hits for AMP pages, you’ll miss meaningful insights about your mobile users.

 

Basic setup to measure page views

To create a basic installation of Google Analytics on an AMP page, copy this code snippet and replace <GA_MEASUREMENT_ID> with the property ID you would like to use. (Find your Google Analytics ID.)

Add the following code into AMP template html_start.php file within <head></head> closing tag.

<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<amp-analytics data-credentials="include" type="gtag"> <script type="application/json">
{
  "vars" : {
    "gtag_id": "<GA_MEASUREMENT_ID>",
    "config" : {
      "<GA_MEASUREMENT_ID>": { "groups": "default" }
    }
  }
}
</script> </amp-analytics>

 


What is zitURL - shorten link?

zitURL - shorten link is a completely free tool where you can create short links, which apart from being free, you get paid! So, now you can make money from home, when managing and protecting your links. Register now!

Shorten URLs and earn money

Signup for an account in just 2 minutes. Once you've completed your registration just start '. 'creating short URLs and sharing the links with your family and friends.