A/b test default language in home product

This commit is contained in:
Matt Lott 2016-09-02 15:33:16 -07:00
parent 8dacc619a0
commit 3dcfa2cc8a
2 changed files with 26 additions and 7 deletions

View file

@ -197,6 +197,16 @@ module.exports = class User extends CocoModel
application.tracker.identify hintsGroup: @hintsGroup unless me.isAdmin() application.tracker.identify hintsGroup: @hintsGroup unless me.isAdmin()
@hintsGroup @hintsGroup
getDefaultLanguageGroup: ->
# A/B test default programming language in home version
return @defaultLanguageGroup if @defaultLanguageGroup
group = me.get('testGroupNumber') % 2
@defaultLanguageGroup = switch group
when 0 then 'javascript'
when 1 then 'python'
application.tracker.identify defaultLanguageGroup: @defaultLanguageGroup unless me.isAdmin()
@defaultLanguageGroup
getVideoTutorialStylesIndex: (numVideos=0)-> getVideoTutorialStylesIndex: (numVideos=0)->
# A/B Testing video tutorial styles # A/B Testing video tutorial styles
# Not a constant number of videos available (e.g. could be 0, 1, 3, or 4 currently) # Not a constant number of videos available (e.g. could be 0, 1, 3, or 4 currently)

View file

@ -107,12 +107,21 @@ module.exports = class PlayHeroesModal extends ModalView
{id: 'javascript', name: 'JavaScript'} {id: 'javascript', name: 'JavaScript'}
] ]
else else
@codeLanguageList = [ @codeLanguageList = switch me.getDefaultLanguageGroup()
{id: 'python', name: "Python (#{$.i18n.t('choose_hero.default')})"} when 'javascript'
{id: 'javascript', name: 'JavaScript'} [
{id: 'coffeescript', name: "CoffeeScript (#{$.i18n.t('choose_hero.experimental')})"} {id: 'javascript', name: "JavaScript (#{$.i18n.t('choose_hero.default')})"}
{id: 'lua', name: 'Lua'} {id: 'python', name: "Python"}
] {id: 'coffeescript', name: "CoffeeScript (#{$.i18n.t('choose_hero.experimental')})"}
{id: 'lua', name: 'Lua'}
]
else
[
{id: 'python', name: "Python (#{$.i18n.t('choose_hero.default')})"}
{id: 'javascript', name: 'JavaScript'}
{id: 'coffeescript', name: "CoffeeScript (#{$.i18n.t('choose_hero.experimental')})"}
{id: 'lua', name: 'Lua'}
]
if me.isAdmin() or not application.isProduction() if me.isAdmin() or not application.isProduction()
@codeLanguageList.push {id: 'java', name: "Java (#{$.i18n.t('choose_hero.experimental')})"} @codeLanguageList.push {id: 'java', name: "Java (#{$.i18n.t('choose_hero.experimental')})"}
@ -226,7 +235,7 @@ module.exports = class PlayHeroesModal extends ModalView
onCodeLanguageChanged: (e) -> onCodeLanguageChanged: (e) ->
@codeLanguage = @$el.find('#option-code-language').val() @codeLanguage = @$el.find('#option-code-language').val()
@codeLanguageChanged = true @codeLanguageChanged = true
window.tracker?.trackEvent 'Campaign changed code language', category: 'Campaign Hero Select', codeLanguage: @codeLanguage, levelSlug: @options.level?.get('slug')
#- Purchasing the hero #- Purchasing the hero