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()
@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)->
# 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

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