mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
A/B test automatically starting first level
When loading the world map, if user hasn’t already started it.
This commit is contained in:
parent
85471badaa
commit
9c6485b142
3 changed files with 39 additions and 2 deletions
|
@ -101,6 +101,17 @@ module.exports = class User extends CocoModel
|
|||
application.tracker.identify castButtonTextGroup: @castButtonTextGroup
|
||||
@castButtonTextGroup
|
||||
|
||||
getDirectFirstGroup: ->
|
||||
# Group 0 is original behavior
|
||||
# Group 1 goes directly to first level if new user
|
||||
unless @directFirstGroup?
|
||||
if me.isAdmin()
|
||||
@directFirstGroup = 0
|
||||
else
|
||||
@directFirstGroup = me.get('testGroupNumber') % 2
|
||||
application.tracker.identify directFirstGroup: @directFirstGroup
|
||||
@directFirstGroup
|
||||
|
||||
getHighlightArrowSoundGroup: ->
|
||||
return @highlightArrowGroup if @highlightArrowGroup
|
||||
group = me.get('testGroupNumber') % 8
|
||||
|
|
|
@ -108,7 +108,8 @@ module.exports = class WorldMapView extends RootView
|
|||
@$el.find('.level').tooltip()
|
||||
@$el.addClass _.string.slugify @terrain
|
||||
@updateVolume()
|
||||
@highlightElement '.level.next', delay: 500, duration: 60000, rotation: 0, sides: ['top'] unless window.currentModal
|
||||
unless window.currentModal or not @ABTestSkipHighlight? or @ABTestSkipHighlight
|
||||
@highlightElement '.level.next', delay: 500, duration: 60000, rotation: 0, sides: ['top']
|
||||
|
||||
afterInsert: ->
|
||||
super()
|
||||
|
@ -123,6 +124,28 @@ module.exports = class WorldMapView extends RootView
|
|||
for session in @sessions.models
|
||||
@levelStatusMap[session.get('levelID')] = if session.get('state')?.complete then 'complete' else 'started'
|
||||
@render()
|
||||
@initABTestAutoFirstLevel()
|
||||
|
||||
initABTestAutoFirstLevel: ->
|
||||
# A/B testing directly navigating to first level
|
||||
# Excluding admins and users who have already started
|
||||
# TODO: Cleanup @afterRender when this test is finished
|
||||
firstLevelID = 'dungeons-of-kithgard'
|
||||
unless @nextLevel? or firstLevelID of @levelStatusMap
|
||||
testGroup = me.getDirectFirstGroup()
|
||||
if testGroup is 1
|
||||
@ABTestSkipHighlight = true
|
||||
target = $("a[data-level-id='" + firstLevelID + "']")
|
||||
return if $(target).attr('disabled') or $(target).parent().hasClass 'locked'
|
||||
levelElement = $(target).parents('.level')
|
||||
levelID = levelElement.data('level-id')
|
||||
@startLevel levelElement
|
||||
window.tracker?.trackEvent 'World Map', Action: 'ABAutoFirst', levelID: firstLevelID, directFirstGroup: testGroup
|
||||
else if not me.isAdmin()
|
||||
window.tracker?.trackEvent 'World Map', Action: 'ABAutoFirst', levelID: firstLevelID, directFirstGroup: testGroup
|
||||
@ABTestSkipHighlight = false
|
||||
else
|
||||
@ABTestSkipHighlight = false
|
||||
|
||||
onClickMap: (e) ->
|
||||
@$levelInfo?.hide()
|
||||
|
|
|
@ -433,7 +433,10 @@ module.exports = class PlayLevelView extends RootView
|
|||
@victorySeen = true
|
||||
victoryTime = (new Date()) - @loadEndTime
|
||||
if victoryTime > 10 * 1000 # Don't track it if we're reloading an already-beaten level
|
||||
application.tracker?.trackEvent 'Saw Victory', level: @level.get('name'), label: @level.get('name')
|
||||
application.tracker?.trackEvent 'Saw Victory',
|
||||
level: @level.get('name')
|
||||
label: @level.get('name')
|
||||
getDirectFirstGroup: me.getDirectFirstGroup()
|
||||
application.tracker?.trackTiming victoryTime, 'Level Victory Time', @levelID, @levelID, 100
|
||||
|
||||
showVictory: ->
|
||||
|
|
Loading…
Reference in a new issue