Improve getHomePageGroup and narrow to two variants

This commit is contained in:
Nick Winter 2016-02-08 14:20:30 -08:00
parent bb38c58903
commit 435d5bb6d2
2 changed files with 33 additions and 9 deletions

View file

@ -135,18 +135,13 @@ module.exports = class User extends CocoModel
@announcesActionAudioGroup
getHomepageGroup: ->
# return 'control'
# return 'home-with-note'
# return 'new-home-student'
# return 'new-home-characters'
return 'home-with-note' unless _.string.startsWith(me.get('preferredLanguage', true) or 'en-US', 'en')
return @homepageGroup if @homepageGroup
group = me.get('testGroupNumber') % 4
@homepageGroup = switch group
when 0 then 'control'
when 1 then 'home-with-note'
when 2 then 'new-home-student'
when 3 then 'new-home-characters'
application.tracker.identify newHomepageGroup: group unless me.isAdmin()
when 0, 1 'home-with-note'
when 2, 3 then 'new-home-student'
application.tracker.identify newHomepageGroup: @homepageGroup unless me.isAdmin()
return @homepageGroup
# Signs and Portents was receiving updates after test started, and also had a big bug on March 4, so just look at test from March 5 on.

View file

@ -0,0 +1,29 @@
// abHomePageGroup A/B Results
// Test started 2016-02-03
// Main conversion actions (viewing quote requests, playing levels) tracked in Mixpanel
// This just looks at who has a trial request, and then also who created an account, based on homePageGroup
// Usage:
// mongo <address>:<port>/<database> <script file> -u <username> -p <password>
var groups = {
'0': {name: 'control', count: 0, registeredCount: 0},
'1': {name: 'home-with-note', count: 0, registeredCount: 0},
'2': {name: 'new-home-student', count: 0, registeredCount: 0},
'3': {name: 'new-home-characters', count: 0, registeredCount: 0}
};
var requests = db.trial.requests.find({created: {$gt: new Date(2016, 1, 3)}}).toArray();
var userIDs = requests.map(function(r) { return r.applicant; });
var applicants = db.users.find({_id: {$in: userIDs}}).toArray();
var counts = {};
function format(u) {
var group = groups[u.testGroupNumber % 4];
++group.count;
if (u.email)
++group.registeredCount;
return [u.email || u.name || u._id + '', group.name].join('\t');
}
print(applicants.map(format).join('\n'));
print(applicants.length, "trial requests across groups:");
print(JSON.stringify(groups, null, 2));