fix: A/B test marketing opt-in (#448)

fire optimizely event to record opt-in/out for marketing emails

VAN-738
This commit is contained in:
Mubbshar Anwar
2021-10-11 19:12:42 +05:00
committed by GitHub
parent b0df7a0593
commit 2ac0f83e87
3 changed files with 9 additions and 10 deletions

View File

@@ -523,6 +523,13 @@ class RegistrationPage extends React.Component {
value: this.state.totalRegistrationTime,
},
});
if (getConfig().MARKETING_EMAILS_OPT_IN === 'true' && this.state.optimizelyExperimentName === 'marketing_opt_in') {
window.optimizely.push({
type: 'event',
eventName: `marketing-emails-opt-${this.state.marketingOptIn === true ? 'in' : 'out'}`,
});
}
}
return (

View File

@@ -1,6 +1,6 @@
import { call, put, takeEvery } from 'redux-saga/effects';
import { camelCaseObject, getConfig } from '@edx/frontend-platform';
import { camelCaseObject } from '@edx/frontend-platform';
import { logError, logInfo } from '@edx/frontend-platform/logging';
// Actions
@@ -24,14 +24,6 @@ export function* handleNewUserRegistration(action) {
yield put(registerNewUserBegin());
const { redirectUrl, success } = yield call(registerRequest, action.payload.registrationInfo);
const { experimentName } = window;
if (getConfig().MARKETING_EMAILS_OPT_IN === 'true'
&& success && experimentName && experimentName === 'marketing_opt_in') {
window.optimizely.push({
type: 'event',
eventName: `marketing-emails-opt-${action.payload.registrationInfo.opt === true ? 'in' : 'out'}`,
});
}
yield put(registerNewUserSuccess(
redirectUrl,
success,

View File

@@ -34,7 +34,7 @@ const messages = defineMessages({
},
'registration.opt.in.label': {
id: 'registration.opt.in.label',
defaultMessage: 'You will be receive marketing emails by checking it',
defaultMessage: 'Receive marketing emails',
description: 'You will be receive marketing emails by checking it',
},
// Help text