Fixes tracking for unauthorized users client-side

pull/227/head
Dana 2015-12-09 11:06:28 +00:00
rodzic a7740a96dd
commit a1179a9279
1 zmienionych plików z 8 dodań i 3 usunięć

11
node_modules/c9/skip-analytics.js wygenerowano vendored
Wyświetl plik

@ -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;
});