From a1179a92797f74ee37c623b5f4e7cf32513387e8 Mon Sep 17 00:00:00 2001 From: Dana Date: Wed, 9 Dec 2015 11:06:28 +0000 Subject: [PATCH] Fixes tracking for unauthorized users client-side --- node_modules/c9/skip-analytics.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/node_modules/c9/skip-analytics.js b/node_modules/c9/skip-analytics.js index 12e2757b..4a64d0d6 100644 --- a/node_modules/c9/skip-analytics.js +++ b/node_modules/c9/skip-analytics.js @@ -10,16 +10,21 @@ define(function(require, exports, module) { var hasInternalDomain = require("c9/has-internal-domain"); var hasInternalTestName = require("c9/has-internal-test-name"); - function skipAnalytics(user) { + function skipAnalytics(user, allowUnauthorized) { if (!user) return true; - if (user.id === -1) return true; - if (!user.id && user.uid === -1) return true; + if (!allowUnauthorized && hasUnauthorizedId(user)) return true; if (hasInternalTestName(user)) return true; if (hasInternalDomain(user.email)) return true; return false; } + function hasUnauthorizedId(user) { + if (user.id === -1) return true; + + if (!user.id && user.uid === -1) return true; + } + module.exports = skipAnalytics; }); \ No newline at end of file