Skip to content

Commit

Permalink
Disable analytics when LUNA_STUDIO_DEVELOP variable exists. enso-org#286
Browse files Browse the repository at this point in the history
  • Loading branch information
pmlodawski committed Sep 19, 2017
1 parent 4eb6f7d commit 8db4317
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions luna-studio/node-editor/js/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ mixpanel = Mixpanel.init("0d906436719b047c86b7fee8ae550601", {
protocol: 'https'
});

filters = []
var devMode = process.env.LUNA_STUDIO_DEVELOP != null;

var filters = []

function test(title) {
for (var i = 0, len = filters.length; i < len; i++)
Expand All @@ -21,10 +23,15 @@ module.exports = {
},
track: function (title, data) {
if (atom.config.get('luna-studio.analyticsEnabled') && test(title)) {
console.log("track: " + title, data);
mixpanel.track(title, data);
if(devMode) {
console.log("track.accept: " + title, data);
} else {
mixpanel.track(title, data);
}
} else {
console.log("discard: " + title, data);
if(devMode) {
console.log("track.discard: " + title, data);
}
}
}
}

0 comments on commit 8db4317

Please sign in to comment.