{"id":22039562,"url":"https://github.com/mpolinowski/amp_google_analytics","last_synced_at":"2026-01-04T20:45:05.414Z","repository":{"id":111482395,"uuid":"104852076","full_name":"mpolinowski/amp_google_analytics","owner":"mpolinowski","description":"Accelerated Mobile Pages and Google Analytics","archived":false,"fork":false,"pushed_at":"2017-09-26T08:23:06.000Z","size":360,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T19:17:58.288Z","etag":null,"topics":["accelerated-mobile-pages","amp-analytics","amp-html","analytics","analytics-tracking","google"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpolinowski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-26T07:38:22.000Z","updated_at":"2017-09-26T08:06:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2f18220-8f3a-4f74-848e-b1b72f43181e","html_url":"https://github.com/mpolinowski/amp_google_analytics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolinowski%2Famp_google_analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolinowski%2Famp_google_analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolinowski%2Famp_google_analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolinowski%2Famp_google_analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpolinowski","download_url":"https://codeload.github.com/mpolinowski/amp_google_analytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245104529,"owners_count":20561380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accelerated-mobile-pages","amp-analytics","amp-html","analytics","analytics-tracking","google"],"created_at":"2024-11-30T11:11:15.984Z","updated_at":"2026-01-04T20:45:05.377Z","avatar_url":"https://github.com/mpolinowski.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to add Google Analytics to your AMP Webpage\n\n01. [Set up Google Analytics](#01-set-up-google-analytics)\n02. [Tracking ID](#02-tracking_id)\n03. [amp-analytics](#03-amp-analytics)\n04. [Search Console](04-search-console)\n05. [Search Console link to Google Analytics](05-search-console-link-to-google-analytics)\n\n## 01 Set up Google Analytics\n\nCreate a Gmail account and log in to [Google Analytics](https://analytics.google.com). Open the admin panel and add a new property:\n\n\n---\n![](./GA_01.png)\n---\n\n\n## 02 Tracking ID\n\nFill out the form and click to generate a Tracking ID - which will look something like this \"UA-88888888-1\":\n\n\n---\n![](./GA_02.png)\n---\n\n\n## 03 amp-analytics\n\nNow we need to add the [AMP Analytics](https://www.ampproject.org/docs/reference/components/amp-analytics) script to our website inside the \\\u003chead\\\u003e tag:\n\n\n```html\n\u003cscript async custom-element=\"amp-analytics\" src=\"https://cdn.ampproject.org/v0/amp-analytics-0.1.js\"\u003e\u003c/script\u003e\n```\n\nThe tracking ID can now be implemented inside the \\\u003cheader\\\u003e tag of your AMP page, by adding the \\\u003camp-analytics\\\u003e component:\n\n```html\n\u003camp-analytics type=\"googleanalytics\"\u003e\n  \u003cscript type=\"application/json\"\u003e\n  {\n    \"vars\": {\n      \"account\": \"UA-88888888-1\"\n    },\n    \"triggers\": {\n      \"trackPageview\": {\n        \"on\": \"visible\",\n        \"request\": \"pageview\"\n      }\n    }\n  }\n  \u003c/script\u003e\n\u003c/amp-analytics\u003e\n```\n\n\n## 04 Search Console\n\nNow we want to link our new property to the [Search Console](https://www.google.com/webmasters/tools/search-analytics) to get access to reports (e.g. you get information about AMP Errors and general tips to improve your HTML structure /SEO) and a list of keywords that lead Google Search users to your website.\n\nGo back Property Settings:\n\n\n---\n![](./GA_03.png)\n---\n\n\nAnd scroll down to \"Adjust Search Console\":\n\n\n---\n![](./GA_04.png)\n---\n\n\nClick on \"Edit\":\n\n\n---\n![](./GA_05.png)\n---\n\n\nAnd add your new property to your Search Console (this page will **stay open in the background** and you will have to refresh it after you added your new property - **see final step**):\n\n\n---\n![](./GA_06.png)\n\n![](./GA_07.png)\n\n![](./GA_08.png)\n---\n\n\nYou will then be asked to download an HTML file and upload it to the public /root directory of your website - to verify your ownership. Click on Verify and you are DONE!\n\n\n## 05 Search Console link to Google Analytics\n\nNow return to the previous page (still open in the background), refresh and select your new property - then click save:\n\n\n---\n![](./GA_09.png)\n\n![](./GA_10.png)\n---\n\n\nAs seen above, your Property is now linked in Google Analytics and you will start to see search results in your reports.\n\nIt might take a while for crawling information and potential Error Reports to arrive - give it a month... You will be notified by email if something was found in the need of fixing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpolinowski%2Famp_google_analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpolinowski%2Famp_google_analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpolinowski%2Famp_google_analytics/lists"}