feat(analytics): update Google analytics.js to gtag.js (#349)
This commit is contained in:
@@ -975,9 +975,6 @@ enableEmoji = true
|
|||||||
# whether to anonymize IP
|
# whether to anonymize IP
|
||||||
# 是否匿名化用户 IP
|
# 是否匿名化用户 IP
|
||||||
anonymizeIP = true
|
anonymizeIP = true
|
||||||
# whether to use cookie
|
|
||||||
# 是否使用 cookie
|
|
||||||
cookie = false
|
|
||||||
# Fathom Analytics
|
# Fathom Analytics
|
||||||
[params.analytics.fathom]
|
[params.analytics.fathom]
|
||||||
id = ""
|
id = ""
|
||||||
|
|||||||
@@ -596,8 +596,6 @@ Please open the code block below to view the complete sample configuration :(far
|
|||||||
id = ""
|
id = ""
|
||||||
# whether to anonymize IP
|
# whether to anonymize IP
|
||||||
anonymizeIP = true
|
anonymizeIP = true
|
||||||
# whether to use cookie
|
|
||||||
cookie = false
|
|
||||||
# Fathom Analytics
|
# Fathom Analytics
|
||||||
[params.analytics.fathom]
|
[params.analytics.fathom]
|
||||||
id = ""
|
id = ""
|
||||||
|
|||||||
@@ -601,8 +601,6 @@ Please open the code block below to view the complete sample configuration :(far
|
|||||||
id = ""
|
id = ""
|
||||||
# whether to anonymize IP
|
# whether to anonymize IP
|
||||||
anonymizeIP = true
|
anonymizeIP = true
|
||||||
# whether to use cookie
|
|
||||||
cookie = false
|
|
||||||
# Fathom Analytics
|
# Fathom Analytics
|
||||||
[params.analytics.fathom]
|
[params.analytics.fathom]
|
||||||
id = ""
|
id = ""
|
||||||
|
|||||||
@@ -599,8 +599,6 @@ hugo
|
|||||||
id = ""
|
id = ""
|
||||||
# 是否匿名化用户 IP
|
# 是否匿名化用户 IP
|
||||||
anonymizeIP = true
|
anonymizeIP = true
|
||||||
# 是否使用 cookie
|
|
||||||
cookie = false
|
|
||||||
# Fathom Analytics
|
# Fathom Analytics
|
||||||
[params.analytics.fathom]
|
[params.analytics.fathom]
|
||||||
id = ""
|
id = ""
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{{- .Scratch.Set "version" "0.2.7" -}}
|
||||||
{{- $version := "0.2.X" -}}
|
{{- $version := "0.2.X" -}}
|
||||||
|
|
||||||
{{- /* LoveIt theme version detection */ -}}
|
{{- /* LoveIt theme version detection */ -}}
|
||||||
@@ -10,7 +11,6 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- $params := .Params | merge .Site.Params.page -}}
|
{{- $params := .Params | merge .Site.Params.page -}}
|
||||||
{{- .Scratch.Set "version" "0.2.6" -}}
|
|
||||||
|
|
||||||
{{- if eq hugo.Environment "production" -}}
|
{{- if eq hugo.Environment "production" -}}
|
||||||
{{- .Scratch.Set "cdn" .Site.Params.cdn -}}
|
{{- .Scratch.Set "cdn" .Site.Params.cdn -}}
|
||||||
|
|||||||
@@ -2,18 +2,16 @@
|
|||||||
{{- /* Google Analytics */ -}}
|
{{- /* Google Analytics */ -}}
|
||||||
{{- with .google.id -}}
|
{{- with .google.id -}}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());
|
||||||
ga('create', '{{ . }}', {{- if $.google.cookie }}'auto'{{ else }}{ 'storage': 'none' }{{ end }});
|
gtag('config', '{{ . }}'{{ if $.google.anonymizeIP }}, { 'anonymize_ip': true }{{ end }});
|
||||||
{{- if $.google.anonymizeIP }}ga('set', 'anonymizeIp', true);{{ end -}}
|
|
||||||
ga('send', 'pageview');
|
|
||||||
</script>
|
</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 -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- /* Fathom Analytics */ -}}
|
{{- /* Fathom Analytics */ -}}
|
||||||
{{- with .fathom.id -}}
|
{{- with .fathom.id -}}
|
||||||
<script type="text/javascript">
|
<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('set', 'siteId', '{{ . }}');
|
||||||
fathom('trackPageview');
|
fathom('trackPageview');
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user