Skip to content

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

Open
@jmooring

Description

@jmooring

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions