2015-02-10 14:34:11 -05:00
// leaderboardsGroup A/B Results
2015-02-26 17:24:00 -05:00
// Test started 2015-01-30, ended 2015-02-26
// Final results: no differences in level starts or completions. Perhaps they affect playtime or purchases, but harder to say. At least they don't hurt, so wejust turned them on for everyone always.
2015-02-10 14:34:11 -05:00
// Usage:
// mongo <address>:<port>/<database> <script file> -u <username> -p <password>
load ( 'abTestHelpers.js' ) ;
var scriptStartTime = new Date ( ) ;
try {
2015-02-26 17:24:00 -05:00
var startDay = '2015-02-07' ;
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 Level' , 'Saw Victory' ] ;
2015-02-26 17:24:00 -05:00
var levelSlugs = [ 'dungeons-of-kithgard' , 'gems-in-the-deep' , 'shadow-guard' , 'forgetful-gemsmith' , 'kounter-kithwise' , 'kithgard-gates' , 'rich-forager' , 'village-guard' ] ;
2015-02-10 14:34:11 -05:00
// getLeaderboardsGroup
var testGroupFn = function ( testGroupNumber ) {
2015-02-10 16:16:09 -05:00
var group = testGroupNumber % 64 ;
if ( group < 16 ) return 'always' ;
if ( group < 32 ) return 'early' ;
if ( group < 48 ) return 'late' ;
return 'never' ;
2015-02-26 17:24:00 -05:00
} ;
2015-02-10 14:34:11 -05:00
var funnelData = getFunnelData ( startDay , eventFunnel , testGroupFn , levelSlugs ) ;
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" + started + "\t" + finished + "\t" + rate . toFixed ( 2 ) ) ;
}
else if ( level && browser && group ) {
log ( level + "\t" + browser + "\t" + ( browser . length < 8 ? "\t" : "" ) + group + "\t" + started + "\t" + finished + "\t" + rate . toFixed ( 2 ) ) ;
}
else if ( level && group ) {
2015-02-10 14:34:11 -05:00
log ( level + "\t" + group + "\t" + started + "\t" + finished + "\t" + rate . toFixed ( 2 ) ) ;
}
2015-02-11 14:07:32 -05:00
else if ( group ) {
log ( group + "\t" + started + "\t" + finished + "\t" + rate . toFixed ( 2 ) ) ;
}
} ) ;
2015-02-10 14:34:11 -05:00
}
catch ( err ) {
log ( "ERROR: " + err ) ;
printjson ( err ) ;
}
finally {
log ( "Script runtime: " + ( new Date ( ) - scriptStartTime ) ) ;
}