如何将Google Analytics(分析)跟踪ID添加到GitHub页面 [英] How to add Google Analytics Tracking ID to GitHub Pages
问题描述
这可能是一个简单的问题,但我现在对将 Google Analytics跟踪ID 添加到 GitHub页面充满怀疑。
我使用GitHub自动页面生成器来创建我的GitHub页面,但它要求输入Google Analytics(分析)跟踪ID。我尝试注册Google Analytics(分析),但它上面有网站URL。
现在我应该怎么做?
还有一个问题:我们可以在创建GitHub Page后添加Google Analytics跟踪ID吗?
更新:为其他人添加步骤说明
解决此问题:
必须在Google Analytics网站部分包含 username.github.io
(我想跟踪的链接)。
<您可以查看GitHub帮助页面的要求)
- 浏览到您的github页面分支 - 这可能类似于 - < https://github.com/ YourUserName / YourRepository / tree / gh-pages)
- 然后从列出的文件中编辑
index.html
- 现在在
HEAD
index.html
的标记 - 粘贴您的Google Analytics(分析)跟踪ID脚本(如果您已经注册Google分析,则可以在 admin 下浏览它并然后跟踪信息标签)
Could be a simple question but I am full of doubts right now about adding Google Analytics Tracking ID to GitHub page.
I am using GitHub automatic page generator to create my GitHub page but it asks for "Google Analytics Tracking ID". I tried to sign up with Google Analytics but there on it asks for website URL.
Now what I am supposed to do?
One more ques: can we add Google Analytics Tracking ID later on after GitHub Page has been created?
Update: Added steps descriptions for others
Solved it:
had to include username.github.io
(link that I want to track) in Google Analytics website section.
you can check GitHub help page here
After that I was provided with an Tracker ID.
Note: You can easily change or add more websites on Google Analytics page from your Google Analytics admin panel.
Update 2: - Adding Google Analytics Tracking ID to Already created Github pages (As requested by @avi-aryan )
- Browse to your github pages branch - which would be something like -
( https://github.com/YourUserName/YourRepository/tree/gh-pages ) - Then edit
index.html
from listed files - Now in within
HEAD
tag ofindex.html
- paste your Google Analytics Tracking ID Script ( if have already signed up for Google analytics then you can browse it under admin and then tracking info tab )
这篇关于如何将Google Analytics(分析)跟踪ID添加到GitHub页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!