Introduction:
I am going to explain how to use google analytics for AMP pages. What is AMP page.? Check my previous article.
Step1:
Create AMP website and include all the necessary AMP files including
Step2:
Then finally add this script into your AMP page
I am going to explain how to use google analytics for AMP pages. What is AMP page.? Check my previous article.
Step1:
Create AMP website and include all the necessary AMP files including
- <head>
- <script custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js" async></script>
- </head>
Step2:
Then finally add this script into your AMP page
- <amp-analytics type="googleanalytics" id="analytics1">
- <script type="application/json">
- {
- "vars": {
- "account": "Your account Id" //UA-69036925-1
- },
- "triggers": {
- "trackPageview": {
- "on": "visible",
- "request": "pageview"
- }
- }
- }
- </script>
- </amp-analytics>
No comments:
Post a Comment