2015-02-10 14:34:11 -05:00
|
|
|
// gemPromptGroup A/B Results
|
2015-02-10 18:28:45 -05:00
|
|
|
// Test started 2014-11-24
|
2015-02-10 14:34:11 -05:00
|
|
|
|
|
|
|
// Usage:
|
|
|
|
// mongo <address>:<port>/<database> <script file> -u <username> -p <password>
|
|
|
|
|
2015-02-11 16:57:28 -05:00
|
|
|
// TODO: Why is no-prompt group 50% larger?
|
|
|
|
|
2015-02-10 14:34:11 -05:00
|
|
|
load('abTestHelpers.js');
|
|
|
|
|
|
|
|
var scriptStartTime = new Date();
|
|
|
|
try {
|
2015-02-10 18:28:45 -05:00
|
|
|
var startDay = '2014-11-24'
|
2015-02-11 16:57:28 -05:00
|
|
|
// startDay = '2015-01-15'
|
2015-02-10 18:28:45 -05:00
|
|
|
log("Today is " + new Date().toISOString().substr(0, 10));
|
2015-02-10 14:34:11 -05:00
|
|
|
log("Start day is " + startDay);
|
|
|
|
|
|
|
|
var eventFunnel = ['Started purchase', 'Finished gem purchase'];
|
|
|
|
|
|
|
|
// getGemPromptGroup
|
|
|
|
var testGroupFn = function (testGroupNumber) {
|
|
|
|
var group = testGroupNumber % 8
|
|
|
|
return group >= 0 && group <= 3 ? 'prompt' : 'no-prompt';
|
|
|
|
}
|
|
|
|
|
|
|
|
var funnelData = getFunnelData(startDay, eventFunnel, testGroupFn);
|
|
|
|
|
2015-02-11 14:07:32 -05:00
|
|
|
printFunnelData(funnelData, function (day, level, browser, group, started, finished, rate) {
|
|
|
|
if (day && level && browser && group) {
|
|
|
|
log(day + "\t" + group + "\t" + (group === 'prompt' ? "\t": "") + started + "\t" + finished + "\t" + rate.toFixed(2));
|
2015-02-10 14:34:11 -05:00
|
|
|
}
|
2015-02-11 14:07:32 -05:00
|
|
|
else if (group) {
|
|
|
|
log(group + (group === 'prompt' ? "\t": "") + "\t" + started + "\t" + finished + "\t" + rate.toFixed(2));
|
2015-02-10 14:34:11 -05:00
|
|
|
}
|
2015-02-11 14:07:32 -05:00
|
|
|
});
|
2015-02-10 14:34:11 -05:00
|
|
|
}
|
|
|
|
catch(err) {
|
|
|
|
log("ERROR: " + err);
|
|
|
|
printjson(err);
|
|
|
|
}
|
|
|
|
finally {
|
|
|
|
log("Script runtime: " + (new Date() - scriptStartTime));
|
|
|
|
}
|