Skip to content

Commit

Permalink
feat: add submit btn click event (#1178)
Browse files Browse the repository at this point in the history
  • Loading branch information
syedsajjadkazmii authored Feb 28, 2024
1 parent 0306763 commit d6c5415
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/register/RegistrationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
import {
trackSimplifyRegistrationContinueBtnClicked,
trackSimplifyRegistrationSecondStepViewed,
trackSimplifyRegistrationValidatedSubmitBtnClicked,
} from './data/optimizelyExperiment/track';
import useSimplifyRegistrationExperimentVariation
from './data/optimizelyExperiment/useSimplifyRegistrationExperimentVariation';
Expand Down Expand Up @@ -146,6 +147,7 @@ const RegistrationPage = (props) => {
if (isValidatingSimplifiedRegisterFirstPage && backendValidations
&& Object.values(backendValidations).every(value => value === '')
) {
trackSimplifyRegistrationValidatedSubmitBtnClicked(simplifyRegistrationExpVariation);
trackSimplifyRegistrationSecondStepViewed();
dispatch(setSimplifyRegExperimentData(simplifyRegistrationExpVariation, SECOND_STEP));
}
Expand Down Expand Up @@ -294,6 +296,10 @@ const RegistrationPage = (props) => {
return;
}

if (simplifyRegistrationExpVariation === SIMPLIFIED_REGISTRATION_VARIATION
|| simplifyRegistrationExpVariation === DEFAULT_VARIATION) {
trackSimplifyRegistrationValidatedSubmitBtnClicked(simplifyRegistrationExpVariation);
}
// Preparing payload for submission
payload = prepareRegistrationPayload(
payload,
Expand Down
7 changes: 7 additions & 0 deletions src/register/data/optimizelyExperiment/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const eventNames = {
simplifyRegistrationFirstStepViewed: 'edx.bi.user.simplifyregistration.step1.viewed',
simplifyRegistrationSecondStepViewed: 'edx.bi.user.simplifyregistration.step2.viewed',
simplifyRegistrationContinueBtnClicked: 'edx.bi.user.registration.submit.click',
simplifyRegistrationValidatedSubmitBtnClicked: 'edx.bi.user.registration.validated.submit.click',
};

export const trackSimplifyRegistrationFirstStepViewed = (expVariation) => {
Expand All @@ -23,3 +24,9 @@ export const trackSimplifyRegistrationContinueBtnClicked = (expVariation) => {
variation: expVariation,
});
};

export const trackSimplifyRegistrationValidatedSubmitBtnClicked = (expVariation) => {
sendTrackEvent(eventNames.simplifyRegistrationValidatedSubmitBtnClicked, {
variation: expVariation,
});
};

0 comments on commit d6c5415

Please sign in to comment.