且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将 Google Analytics 跟踪 ID 添加到 GitHub 页面

更新时间:2023-11-25 08:11:40

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 )

  1. Browse to your github pages branch - which would be something like -
    ( https://github.com/YourUserName/YourRepository/tree/gh-pages )
  2. Then edit index.html from listed files
  3. Now in within HEAD tag of index.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 )