mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 19:56:23 +00:00
fix(emails): send split-test mailings for social reg accounts
This commit is contained in:
parent
b7797b3e6c
commit
e6c3d00665
2 changed files with 13 additions and 5 deletions
|
|
@ -88,7 +88,13 @@ async function loginSocial (req, res) {
|
|||
.remove({email: savedUser.auth[network].emails[0].value.toLowerCase()})
|
||||
.exec()
|
||||
.then(() => {
|
||||
if (!existingUser) sendTxnEmail(savedUser, 'welcome');
|
||||
if (!existingUser) {
|
||||
if (savedUser._ABtests && savedUser._ABtests.welcomeEmailSplit) {
|
||||
sendTxnEmail(savedUser, savedUser._ABtests.welcomeEmailSplit);
|
||||
} else {
|
||||
sendTxnEmail(savedUser, 'welcome');
|
||||
}
|
||||
}
|
||||
}); // eslint-disable-line max-nested-callbacks
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,14 +129,16 @@ function _setUpNewUser (user) {
|
|||
user.preferences.background = 'violet';
|
||||
|
||||
const testGroup = Math.random();
|
||||
if (testGroup < 0.25) {
|
||||
if (testGroup < 0.2) {
|
||||
user._ABtests.welcomeEmailSplit = 'welcome-v2';
|
||||
} else if (testGroup < 0.5) {
|
||||
} else if (testGroup < 0.4) {
|
||||
user._ABtests.welcomeEmailSplit = 'welcome-v2b';
|
||||
} else if (testGroup < 0.75) {
|
||||
} else if (testGroup < 0.6) {
|
||||
user._ABtests.welcomeEmailSplit = 'welcome-v2c';
|
||||
} else {
|
||||
} else if (testGroup < 0.8) {
|
||||
user._ABtests.welcomeEmailSplit = 'welcome-v2d';
|
||||
} else {
|
||||
user._ABtests.welcomeEmailSplit = 'welcome';
|
||||
}
|
||||
|
||||
if (user.registeredThrough === 'habitica-web') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue