Skip to content

Commit

Permalink
mixpanel: make options usage data super properties
Browse files Browse the repository at this point in the history
- wilting threshold as raw value
- topics as true/false as previously
  • Loading branch information
raine committed May 16, 2013
1 parent aa01089 commit e7adc80
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
21 changes: 0 additions & 21 deletions lib/mixpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,3 @@ var track;
}
};
})();

// Build an object from options Store to track how settings are used in options
var prepareProps = function() {
var props = {};

var topics = settings.get('topics');
if (topics) {
props.disabledTopics = _.contains(_.values(topics), false);
} else {
props.disabledTopics = false;
}

var threshold = settings.get('wilting-threshold');
if (threshold) {
props.thresholdUsed = threshold !== DEFAULTS['wilting-threshold'];
} else {
props.thresholdUsed = false;
}

return props;
};
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
});

chrome.browserAction.onClicked.addListener(function() {
track('Button Click', prepareProps());
track('Button Click');

var url;
if (url = localStorage.actionURL) {
Expand Down
23 changes: 23 additions & 0 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@ var DASHBOARD_URL = 'http://www.memrise.com/home/';
var settings = new Store("settings", DEFAULTS);
var resetTopics;

// Build an object from options Store to track how settings are used
var prepareProps = function() {
var props = {};

var topics = settings.get('topics');
if (topics) {
props['Topics Disabled'] = _.contains(_.values(topics), false);
} else {
props['Topics Disabled'] = false;
}

props['Wilting Threshold'] = settings.get('wilting-threshold');

return props;
};

// HACK: Store bindEvent doesn't work
var oldset = settings.set;
settings.set = function() {
oldset.apply(settings, arguments);
mixpanel.register(prepareProps());
};

$(document).ready(function() {
// Text input logic
$('input[type=text]')
Expand Down

0 comments on commit e7adc80

Please sign in to comment.