Replies: 1 comment 3 replies
-
|
按照教程添加 Google Analytics 功能,运行也没有提示问题,但是没有收到数据该怎么办呀?
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Noll 是一个针对 GitHub 生态而设计的静态站点生成器,默认支持
Google Analytics。用户无需关心 Noll 是如何添加 Google Analytics 的,只需要设置好Google Analytics Measurement id(简称GAMID) 即可直接添加 Google Analytics 功能。设置 GAMID
依托于 GitHub 生态,我们无需编辑脚本文件,只需添加一个环境变量即可让 Google analytics 生效,方法如下:
进入仓库设置页面,点击左侧页面的
Secrets and variables按钮,点击Actions按钮;进入
Actions secrets and variables页面,点击VariablesTab;点击页面右上角的
New repository variable按钮,创建一个环境变量,变量名填写为GAMID,变量值为你的Google Analytics Measurement id;点击
New variable按钮,完成设置。通过以上设置,我们的
NollAction会读取vars.GAMID的值,并把这个值传递给Noll。Re-run all jobs
设置完
varialbe后,我们要重新运行一次Actions,方法如下:进入仓库的
Actions页面,点击最近运行的一次Deploy site to Pages工作流,如下:进入工作流页面,点击右上角的
Re-run all jobs按钮,点击Re-run jobs按钮确定,等待重新运行完成。到此你的站点已经加上了 Google Analytics 功能,尝试访问你的网站,查看 Google Analytics 后台,是不是已经有数据了呢?
Beta Was this translation helpful? Give feedback.
All reactions