summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJeremy Jackson <jjackson@gitlab.com>2019-08-23 07:11:26 +0000
committerKushal Pandya <kushalspandya@gmail.com>2019-08-23 07:11:26 +0000
commitca9598c1fb9bc408a26793d419b19f39314efe3f (patch)
treefaff18e02bdd152d0a3221b2543c102709a77954 /app
parente12f7fe062574b0ad3e271b149928252a99119f5 (diff)
downloadgitlab-ce-ca9598c1fb9bc408a26793d419b19f39314efe3f.tar.gz
Add logic for respecting browser DNT setting
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/tracking.js8
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 = {}) {