mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-16 20:53:59 +02:00
@@ -48,6 +48,9 @@ type GoogleAnalytics struct {
|
|||||||
// Enabling this will make the GA templates respect the
|
// Enabling this will make the GA templates respect the
|
||||||
// "Do Not Track" HTTP header. See https://www.paulfurley.com/google-analytics-dnt/.
|
// "Do Not Track" HTTP header. See https://www.paulfurley.com/google-analytics-dnt/.
|
||||||
RespectDoNotTrack bool
|
RespectDoNotTrack bool
|
||||||
|
|
||||||
|
// Enabling this will make it so the users' IP addresses are anonymized within Google Analytics.
|
||||||
|
AnonymizeIP bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instagram holds the privacy configuration settings related to the Instagram shortcode.
|
// Instagram holds the privacy configuration settings related to the Instagram shortcode.
|
||||||
|
@@ -34,6 +34,7 @@ disable = true
|
|||||||
[privacy.googleAnalytics]
|
[privacy.googleAnalytics]
|
||||||
disable = true
|
disable = true
|
||||||
respectDoNotTrack = true
|
respectDoNotTrack = true
|
||||||
|
anonymizeIP = true
|
||||||
[privacy.instagram]
|
[privacy.instagram]
|
||||||
disable = true
|
disable = true
|
||||||
simple = true
|
simple = true
|
||||||
@@ -59,6 +60,7 @@ simple = true
|
|||||||
assert.True(pc.Disqus.Disable)
|
assert.True(pc.Disqus.Disable)
|
||||||
assert.True(pc.GoogleAnalytics.Disable)
|
assert.True(pc.GoogleAnalytics.Disable)
|
||||||
assert.True(pc.GoogleAnalytics.RespectDoNotTrack)
|
assert.True(pc.GoogleAnalytics.RespectDoNotTrack)
|
||||||
|
assert.True(pc.GoogleAnalytics.AnonymizeIP)
|
||||||
assert.True(pc.Instagram.Disable)
|
assert.True(pc.Instagram.Disable)
|
||||||
assert.True(pc.Instagram.Simple)
|
assert.True(pc.Instagram.Simple)
|
||||||
assert.True(pc.SpeakerDeck.Disable)
|
assert.True(pc.SpeakerDeck.Disable)
|
||||||
|
@@ -47,7 +47,10 @@ Disqus:
|
|||||||
b.Build(BuildCfg{})
|
b.Build(BuildCfg{})
|
||||||
|
|
||||||
// Gheck GA regular and async
|
// Gheck GA regular and async
|
||||||
b.AssertFileContent("public/index.html", "'script','https://www.google-analytics.com/analytics.js','ga');\n\tga('create', 'ga_id', 'auto')", "<script async src='//www.google-analytics.com/analytics.js'>")
|
b.AssertFileContent("public/index.html",
|
||||||
|
"'anonymizeIp', true",
|
||||||
|
"'script','https://www.google-analytics.com/analytics.js','ga');\n\tga('create', 'ga_id', 'auto')",
|
||||||
|
"<script async src='//www.google-analytics.com/analytics.js'>")
|
||||||
|
|
||||||
// Disqus
|
// Disqus
|
||||||
b.AssertFileContent("public/index.html", "\"disqus_shortname\" + '.disqus.com/embed.js';")
|
b.AssertFileContent("public/index.html", "\"disqus_shortname\" + '.disqus.com/embed.js';")
|
||||||
|
@@ -143,6 +143,23 @@ shortname = "disqus_shortname"
|
|||||||
[services.googleAnalytics]
|
[services.googleAnalytics]
|
||||||
id = "ga_id"
|
id = "ga_id"
|
||||||
|
|
||||||
|
[privacy]
|
||||||
|
[privacy.disqus]
|
||||||
|
disable = false
|
||||||
|
[privacy.googleAnalytics]
|
||||||
|
respectDoNotTrack = true
|
||||||
|
anonymizeIP = true
|
||||||
|
[privacy.instagram]
|
||||||
|
simple = true
|
||||||
|
[privacy.speakerDeck]
|
||||||
|
[privacy.twitter]
|
||||||
|
enableDNT = true
|
||||||
|
[privacy.vimeo]
|
||||||
|
disable = false
|
||||||
|
[privacy.youtube]
|
||||||
|
disable = false
|
||||||
|
privacyEnhanced = true
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
func (s *sitesBuilder) WithSimpleConfigFile() *sitesBuilder {
|
func (s *sitesBuilder) WithSimpleConfigFile() *sitesBuilder {
|
||||||
|
@@ -111,6 +111,7 @@ if (!doNotTrack) {
|
|||||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||||
ga('create', '{{ . }}', 'auto');
|
ga('create', '{{ . }}', 'auto');
|
||||||
ga('send', 'pageview');
|
ga('send', 'pageview');
|
||||||
|
{{ if $pc.AnonymizeIP }}ga('set', 'anonymizeIp', true);{{ end -}}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -133,6 +134,7 @@ if (!doNotTrack) {
|
|||||||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
||||||
ga('create', '{{ . }}', 'auto');
|
ga('create', '{{ . }}', 'auto');
|
||||||
ga('send', 'pageview');
|
ga('send', 'pageview');
|
||||||
|
{{ if $pc.AnonymizeIP }}ga('set', 'anonymizeIp', true);{{ end -}}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script async src='//www.google-analytics.com/analytics.js'></script>
|
<script async src='//www.google-analytics.com/analytics.js'></script>
|
||||||
|
@@ -10,6 +10,7 @@ if (!doNotTrack) {
|
|||||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||||
ga('create', '{{ . }}', 'auto');
|
ga('create', '{{ . }}', 'auto');
|
||||||
ga('send', 'pageview');
|
ga('send', 'pageview');
|
||||||
|
{{ if $pc.AnonymizeIP }}ga('set', 'anonymizeIp', true);{{ end -}}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@@ -7,6 +7,7 @@ if (!doNotTrack) {
|
|||||||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
||||||
ga('create', '{{ . }}', 'auto');
|
ga('create', '{{ . }}', 'auto');
|
||||||
ga('send', 'pageview');
|
ga('send', 'pageview');
|
||||||
|
{{ if $pc.AnonymizeIP }}ga('set', 'anonymizeIp', true);{{ end -}}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script async src='//www.google-analytics.com/analytics.js'></script>
|
<script async src='//www.google-analytics.com/analytics.js'></script>
|
||||||
|
Reference in New Issue
Block a user