A/B/C test the first subscription prompt level

This commit is contained in:
Nick Winter 2015-09-18 08:28:04 -07:00
parent dc10dc3b61
commit 1819911551
2 changed files with 18 additions and 4 deletions

View file

@ -131,6 +131,17 @@ module.exports = class User extends CocoModel
application.tracker.identify fourthLevelGroup: @fourthLevelGroup unless me.isAdmin()
@fourthLevelGroup
getSubscriptionPromptGroup: ->
return @subscriptionPromptGroup if @subscriptionPromptGroup
group = me.get('testGroupNumber') % 3
@subscriptionPromptGroup = switch group
when 0 then 'favorable-odds'
when 1 then 'tactical-strike'
when 2 then 'boom-and-bust'
@subscriptionPromptGroup = 'favorable-odds' if me.isAdmin()
application.tracker.identify subscriptionPromptGroup: @subscriptionPromptGroup unless me.isAdmin()
@subscriptionPromptGroup
getVideoTutorialStylesIndex: (numVideos=0)->
# A/B Testing video tutorial styles
# Not a constant number of videos available (e.g. could be 0, 1, 3, or 4 currently)

View file

@ -305,6 +305,11 @@ module.exports = class CampaignView extends RootView
determineNextLevel: (levels) ->
foundNext = false
dontPointTo = ['lost-viking', 'kithgard-mastery'] # Challenge levels we don't want most players bashing heads against
subscriptionPrompts = [{slug: 'boom-and-bust', unless: 'defense-of-plainswood'}]
if me.getSubscriptionPromptGroup() is 'favorable-odds'
subscriptionPrompts.push slug: 'favorable-odds', unless: 'the-raised-sword'
if me.getSubscriptionPromptGroup() is 'tactical-strike'
subscriptionPrompts.push slug: 'tactical-strike', unless: 'a-mayhem-of-munchkins'
for level in levels
# Iterate through all levels in order and look to find the first unlocked one that meets all our criteria for being pointed out as the next level.
level.nextLevels = (reward.level for reward in level.rewards ? [] when reward.level)
@ -321,10 +326,8 @@ module.exports = class CampaignView extends RootView
# Should we point this level out?
if nextLevel and not nextLevel.locked and not nextLevel.disabled and @levelStatusMap[nextLevel.slug] isnt 'complete' and nextLevel.slug not in dontPointTo and not nextLevel.replayable and (
me.isPremium() or
not nextLevel.requiresSubscription or
(nextLevel.slug is 'boom-and-bust' and not @levelStatusMap['defense-of-plainswood']) or
(nextLevel.slug is 'favorable-odds' and not @levelStatusMap['the-raised-sword'])
me.isPremium() or not nextLevel.requiresSubscription or
_.any(subscriptionPrompts, (prompt) => nextLevel.slug is prompt.slug and not @levelStatusMap[prompt.unless])
)
nextLevel.next = true
foundNext = true