Skip to content

Commit

Permalink
feat: remove optimizely event (openedx#1051)
Browse files Browse the repository at this point in the history
VAN-1624
  • Loading branch information
zainab-amir committed Sep 12, 2023
1 parent 512deae commit 4df13cf
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SEGMENT_KEY=''
SITE_NAME=null
INFO_EMAIL=''
# ***** Cookies *****
REGISTER_CONVERSION_COOKIE_NAME=null
USER_RETENTION_COOKIE_NAME=null
# ***** Links *****
LOGIN_ISSUE_SUPPORT_LINK=''
AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK=null
Expand Down
1 change: 0 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ SEGMENT_KEY=''
SITE_NAME='Your Platform Name Here'
INFO_EMAIL='info@example.com'
# ***** Cookies *****
REGISTER_CONVERSION_COOKIE_NAME='openedx-user-register-conversion'
SESSION_COOKIE_DOMAIN='localhost'
USER_INFO_COOKIE_NAME='edx-user-info'
# ***** Links *****
Expand Down
1 change: 0 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ ORDER_HISTORY_URL='http://localhost:1996/orders'
REFRESH_ACCESS_TOKEN_ENDPOINT='http://localhost:18000/login_refresh'
SEGMENT_KEY=''
SITE_NAME='Your Platform Name Here'
REGISTER_CONVERSION_COOKIE_NAME='openedx-user-register-conversion'
APP_ID=''
MFE_CONFIG_API_URL=''
2 changes: 1 addition & 1 deletion src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const configuration = {
// Cookies related configs
SESSION_COOKIE_DOMAIN: process.env.SESSION_COOKIE_DOMAIN,
REGISTER_CONVERSION_COOKIE_NAME: process.env.REGISTER_CONVERSION_COOKIE_NAME || null,
USER_RETENTION_COOKIE_NAME: process.env.USER_RETENTION_COOKIE_NAME || 'authn-returning-user',
// Features
DISABLE_ENTERPRISE_LOGIN: process.env.DISABLE_ENTERPRISE_LOGIN || '',
ENABLE_DYNAMIC_REGISTRATION_FIELDS: process.env.ENABLE_DYNAMIC_REGISTRATION_FIELDS || false,
Expand Down
19 changes: 2 additions & 17 deletions src/register/RegistrationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,26 +172,11 @@ const RegistrationPage = (props) => {

useEffect(() => {
if (registrationResult.success) {
// This event is used by GTM
sendTrackEvent('edx.bi.user.account.registered.client', {});

// Optimizely registration conversion event
window.optimizely = window.optimizely || [];
window.optimizely.push({
type: 'event',
eventName: 'authn-registration-conversion',
});

// We probably don't need this cookie because this fires the same event as
// above for optimizely using GTM.
setCookie(getConfig().REGISTER_CONVERSION_COOKIE_NAME, true);
// This is used by the "User Retention Rate Event" on GTM
setCookie('authn-returning-user');

// Fire GTM event used for integration with impact.com
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'ImpactRegistrationEvent',
});
setCookie(getConfig().USER_RETENTION_COOKIE_NAME, true);
}
}, [registrationResult]);

Expand Down
6 changes: 3 additions & 3 deletions src/register/RegistrationPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('RegistrationPage', () => {
mergeConfig({
PRIVACY_POLICY: 'https://privacy-policy.com',
TOS_AND_HONOR_CODE: 'https://tos-and-honot-code.com',
REGISTER_CONVERSION_COOKIE_NAME: process.env.REGISTER_CONVERSION_COOKIE_NAME,
USER_RETENTION_COOKIE_NAME: 'authn-returning-user',
});

let props = {};
Expand Down Expand Up @@ -527,7 +527,7 @@ describe('RegistrationPage', () => {
expect(registrationPage.find('input#password').length).toEqual(0);
});

it('should check registration conversion cookie', () => {
it('should check user retention cookie', () => {
store = mockStore({
...initialState,
register: {
Expand All @@ -539,7 +539,7 @@ describe('RegistrationPage', () => {
});

renderer.create(routerWrapper(reduxWrapper(<IntlRegistrationPage {...props} />)));
expect(document.cookie).toMatch(`${getConfig().REGISTER_CONVERSION_COOKIE_NAME}=true`);
expect(document.cookie).toMatch(`${getConfig().USER_RETENTION_COOKIE_NAME}=true`);
});

it('should redirect to url returned in registration result after successful account creation', () => {
Expand Down

0 comments on commit 4df13cf

Please sign in to comment.