mirror of
https://github.com/dillonzq/LoveIt.git
synced 2025-04-17 19:11:57 +02:00
feat(analytics): update Google analytics.js to gtag.js (#349)
This commit is contained in:
parent
2ab3d976c0
commit
83869e0fc8
6 changed files with 5 additions and 16 deletions
|
@ -975,9 +975,6 @@ enableEmoji = true
|
|||
# whether to anonymize IP
|
||||
# 是否匿名化用户 IP
|
||||
anonymizeIP = true
|
||||
# whether to use cookie
|
||||
# 是否使用 cookie
|
||||
cookie = false
|
||||
# Fathom Analytics
|
||||
[params.analytics.fathom]
|
||||
id = ""
|
||||
|
|
|
@ -596,8 +596,6 @@ Please open the code block below to view the complete sample configuration :(far
|
|||
id = ""
|
||||
# whether to anonymize IP
|
||||
anonymizeIP = true
|
||||
# whether to use cookie
|
||||
cookie = false
|
||||
# Fathom Analytics
|
||||
[params.analytics.fathom]
|
||||
id = ""
|
||||
|
|
|
@ -601,8 +601,6 @@ Please open the code block below to view the complete sample configuration :(far
|
|||
id = ""
|
||||
# whether to anonymize IP
|
||||
anonymizeIP = true
|
||||
# whether to use cookie
|
||||
cookie = false
|
||||
# Fathom Analytics
|
||||
[params.analytics.fathom]
|
||||
id = ""
|
||||
|
|
|
@ -599,8 +599,6 @@ hugo
|
|||
id = ""
|
||||
# 是否匿名化用户 IP
|
||||
anonymizeIP = true
|
||||
# 是否使用 cookie
|
||||
cookie = false
|
||||
# Fathom Analytics
|
||||
[params.analytics.fathom]
|
||||
id = ""
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{{- .Scratch.Set "version" "0.2.7" -}}
|
||||
{{- $version := "0.2.X" -}}
|
||||
|
||||
{{- /* LoveIt theme version detection */ -}}
|
||||
|
@ -10,7 +11,6 @@
|
|||
{{- end -}}
|
||||
|
||||
{{- $params := .Params | merge .Site.Params.page -}}
|
||||
{{- .Scratch.Set "version" "0.2.6" -}}
|
||||
|
||||
{{- if eq hugo.Environment "production" -}}
|
||||
{{- .Scratch.Set "cdn" .Site.Params.cdn -}}
|
||||
|
|
|
@ -2,18 +2,16 @@
|
|||
{{- /* Google Analytics */ -}}
|
||||
{{- with .google.id -}}
|
||||
<script type="text/javascript">
|
||||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
||||
ga('create', '{{ . }}', {{- if $.google.cookie }}'auto'{{ else }}{ 'storage': 'none' }{{ end }});
|
||||
{{- if $.google.anonymizeIP }}ga('set', 'anonymizeIp', true);{{ end -}}
|
||||
ga('send', 'pageview');
|
||||
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());
|
||||
gtag('config', '{{ . }}'{{ if $.google.anonymizeIP }}, { 'anonymize_ip': true }{{ end }});
|
||||
</script>
|
||||
{{- dict "source" "https://www.google-analytics.com/analytics.js" "async" true | partial "plugin/script.html" -}}
|
||||
{{- printf "https://www.googletagmanager.com/gtag/js?id=%s" . | dict "async" true "source" | partial "plugin/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Fathom Analytics */ -}}
|
||||
{{- with .fathom.id -}}
|
||||
<script type="text/javascript">
|
||||
window.fathom=window.fathom||function(){(fathom.q=fathom.q||[]).push(arguments)};
|
||||
window.fathom=window.fathom||function(){(fathom.q=fathom.q||[]).push(arguments);};
|
||||
fathom('set', 'siteId', '{{ . }}');
|
||||
fathom('trackPageview');
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue