所以我最近开始用 Pelican 写博客,除了谷歌分析之外,一切都很好。我使用
make s3_upload
命令,它使用 publishconf.py 文件。
要获取我的跟踪 ID,我所做的只是将我的跟踪 ID 从 google 分析页面复制粘贴到 publishconf.py 文件中的 Google Analytics 行,如下所示
# Following items are often useful when publishing
#DISQUS_SITENAME = ""
GOOGLE_ANALYTICS = "UA-########-#"
任何帮助将不胜感激,我一直在绞尽脑汁试图解决这个问题。
最佳答案
解决方案
GOOGLE_ANALYTICS = "UA-########-#"
鹈鹕含量
鹈鹕-s publishconf.py 。
cd output && git push origin master
测试 这些步骤有效:
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-125105451-1', 'auto');
ga('send', 'pageview');
</script>
上下文 : 部署到 github 页面
博客的 Git:
cd output/
git init .
git remote add origin git@github.com:<username>/<username>.github.io.git
# Deploy with:
# git add . && git commit -m "Commit description" && git push origin master
博客引擎的 Git:
cd output && cd .. # ensure to be in the good repository
git init .
git submodule add git@github.com:<username>/<username>.github.io.git output/
关于google-analytics - 让 Google 分析与 Pelican 一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42129991/