chore(email): split test for welcome message

This commit is contained in:
Sabe Jones
2019-02-22 15:13:32 -06:00
parent 2d35009bee
commit 10b69986c0
2 changed files with 13 additions and 1 deletions

View File

@@ -183,7 +183,12 @@ async function registerLocal (req, res, { isV3 = false }) {
EmailUnsubscription
.remove({email: savedUser.auth.local.email})
.then(() => {
if (!existingUser) sendTxnEmail(savedUser, 'welcome');
if (existingUser) return;
if (savedUser._ABtests && savedUser._ABtests.emailSplit && savedUser._ABtests.emailSplit === '20190222_welcome-v2') {
sendTxnEmail(savedUser, 'welcome-v2');
} else {
sendTxnEmail(savedUser, 'welcome');
}
});
if (!existingUser) {

View File

@@ -128,6 +128,13 @@ function _setUpNewUser (user) {
user.purchased.background.violet = true;
user.preferences.background = 'violet';
const testGroup = Math.random();
if (testGroup < 0.5) {
user._ABtests.emailSplit = '20190222_welcome';
} else {
user._ABtests.emailSplit = '20190222_welcome-v2';
}
if (user.registeredThrough === 'habitica-web') {
taskTypes = ['habit', 'daily', 'todo', 'reward', 'tag'];