mirror of
https://github.com/MeiK2333/github-style.git
synced 2025-10-15 13:52:58 +00:00
add google analytics
This commit is contained in:
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- Google Analytics
|
|
||||||
- 评论
|
- 评论
|
||||||
- 自定义菜单
|
- 自定义菜单
|
||||||
- 更多链接平台支持
|
- 更多链接平台支持
|
||||||
|
@@ -39,3 +39,19 @@
|
|||||||
{{ with .OutputFormats.Get "json" }}
|
{{ with .OutputFormats.Get "json" }}
|
||||||
<link href="{{ .RelPermalink }}" rel="alternate" type="application/json" title="{{ $.Site.Title }}" />
|
<link href="{{ .RelPermalink }}" rel="alternate" type="application/json" title="{{ $.Site.Title }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
<!-- Google Analytics -->
|
||||||
|
{{ if eq (getenv "HUGO_ENV") "production"}}
|
||||||
|
{{ with .Site.GoogleAnalytics }}
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
|
||||||
|
<script>
|
||||||
|
if (navigator.doNotTrack !== '1') {
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag() { dataLayer.push(arguments); }
|
||||||
|
gtag('js', new Date());
|
||||||
|
|
||||||
|
gtag('config', '{{ . }}');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
Reference in New Issue
Block a user