Google analytics 让谷歌分析与鹈鹕合作
所以我最近开始在Pelican上写博客,除了Google Analytics,一切都很顺利。我使用Google analytics 让谷歌分析与鹈鹕合作,google-analytics,pelican,Google Analytics,Pelican,所以我最近开始在Pelican上写博客,除了Google Analytics,一切都很顺利。我使用 make s3_upload 命令,该命令使用publishconf.py文件 为了获取我的跟踪ID,我所做的只是将我的跟踪ID从google analytics页面复制粘贴到publishconf.py文件中的google analytics行中,如下所示 # Following items are often useful when publishing #DISQUS_SITENAME
make s3_upload
命令,该命令使用publishconf.py文件
为了获取我的跟踪ID,我所做的只是将我的跟踪ID从google analytics页面复制粘贴到publishconf.py文件中的google analytics行中,如下所示
# Following items are often useful when publishing
#DISQUS_SITENAME = ""
GOOGLE_ANALYTICS = "UA-########-#"
任何帮助都将不胜感激,我一直在绞尽脑汁试图解决这个问题 解决方案
<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>
(函数(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]| |函数(){
(i[r].q=i[r].q | |[]).push(参数)},i[r].l=1*新日期();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(窗口、文档、“脚本”和https://www.google-analytics.com/analytics.js","ga",;
ga(“创建”、“UA-125105451-1”、“自动”);
ga(‘发送’、‘页面浏览’);
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
cd输出/
git init。
git远程添加源git@github.com:/.github.io.git
#部署时使用:
#吉特增补,git提交-m“提交描述”&&git推送源主机
博客引擎的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/
cd输出和&cd确保在良好的存储库中
git init。
git子模块添加git@github.com:/.github.io.git输出/
如果站点的输出中没有分析片段,则可能是您使用的主题没有包含正确的代码
每个主题都应该有一个base.html
文件,您应该查看该文件以确保它包含在其中。如果没有,您可以添加以下内容:
{%if GOOGLE_ANALYTICS%}
window.dataLayer=window.dataLayer | |[];
函数gtag(){dataLayer.push(参数);}
gtag('js',新日期());
gtag('config','{{GOOGLE_ANALYTICS}}}');
{%endif%}
您能否确认Pelican呈现的HTML中存在Google Analytics跟踪片段?就是这样,它不在任何创建的输出中。我查看了模板,里面也没有任何内容。正如我所看到的,有两个选项可以将其添加到主题中,或者切换主题。谢谢你的帮助!我知道这很愚蠢,我也有同样的问题。我定义了GOOGLE\u ANALYTICS
变量,但我的输出中缺少该代码段。也许他们已经解决了。对我来说,这只不过是增加了GOOGLE\u分析的价值