Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tpl/tplimpl: Always respect the browser's "do not track" setting with GA template #13307

Open
jmooring opened this issue Jan 24, 2025 · 1 comment
Labels

Comments

@jmooring
Copy link
Member

By default, with the Google Analytics template, we do not respect the browser's "do not track" setting:

if ({{ site.Config.Privacy.GoogleAnalytics.RespectDoNotTrack }}) {
var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack);
var doNotTrack = (dnt == "1" || dnt == "yes");
}
if (!doNotTrack) {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ . }}');
}

I can't think of a good reason for overriding a visitor's preferences.

I suggest we deprecate this config setting and always respect the visitor's preference.

cc: @chalin

@bep
Copy link
Member

bep commented Jan 25, 2025

I can't think of a good reason for overriding a visitor's preferences.

This is the script you get from Google:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-MBZGKNMDWC"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-MBZGKNMDWC');
</script>

Many site managers will want the above, I don't think Hugo want to take a morale standpoint here.

But I do agree that respectDoNotTrack can be default true, but I don't think we can remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy