如何将 Google Analytics 跟踪 ID 添加到 GitHub 页面 [英] How to add Google Analytics Tracking ID to GitHub Pages

查看:39
本文介绍了如何将 Google Analytics 跟踪 ID 添加到 GitHub 页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能是一个简单的问题,但我现在对将 Google Analytics 跟踪 ID 添加到 GitHub 页面 充满疑问.

我正在使用 GitHub 自动页面生成器来创建我的 GitHub 页面,但它要求提供Google Analytics 跟踪 ID".我尝试注册 Google Analytics,但它要求提供网站 URL.

现在我该怎么办?

还有一个问题:我们可以在创建 GitHub 页面后添加 Google Analytics 跟踪 ID 吗?

解决方案

更新:为其他人添加了步骤说明

解决了:
必须在 Google Analytics 网站部分包含 username.github.io(我想跟踪的链接).

您可以查看 GitHub 帮助页面 )

  1. 浏览到您的 github pages 分支 - 类似于 -
    ( https://github.com/YourUserName/YourRepository/tree/gh-pages )
  2. 然后从列出的文件中编辑 index.html
  3. 现在在 index.htmlHEAD 标签内 - 粘贴您的 Google Analytics 跟踪 ID 脚本(如果已经注册了 Google Analytics,那么您可以在 admin,然后是 tracking info 标签 )

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 )

  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 )

这篇关于如何将 Google Analytics 跟踪 ID 添加到 GitHub 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆