diff options
author | Jeremy Jackson <jjackson@gitlab.com> | 2019-08-23 07:11:26 +0000 |
---|---|---|
committer | Kushal Pandya <kushalspandya@gmail.com> | 2019-08-23 07:11:26 +0000 |
commit | ca9598c1fb9bc408a26793d419b19f39314efe3f (patch) | |
tree | faff18e02bdd152d0a3221b2543c102709a77954 /app/assets | |
parent | e12f7fe062574b0ad3e271b149928252a99119f5 (diff) | |
download | gitlab-ce-ca9598c1fb9bc408a26793d419b19f39314efe3f.tar.gz |
Add logic for respecting browser DNT setting
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/tracking.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/assets/javascripts/tracking.js b/app/assets/javascripts/tracking.js index 2d0b099cf0b..a852f937eec 100644 --- a/app/assets/javascripts/tracking.js +++ b/app/assets/javascripts/tracking.js @@ -15,8 +15,14 @@ const extractData = (el, opts = {}) => { }; export default class Tracking { + static trackable() { + return !['1', 'yes'].includes( + window.doNotTrack || navigator.doNotTrack || navigator.msDoNotTrack, + ); + } + static enabled() { - return typeof window.snowplow === 'function'; + return typeof window.snowplow === 'function' && this.trackable(); } static event(category = document.body.dataset.page, event = 'generic', data = {}) { |