Skip to content

Commit

Permalink
feat: add submit btn click event for default register page (#1176)
Browse files Browse the repository at this point in the history
Co-authored-by: Syed Sajjad  Hussain Shah <[email protected]>
  • Loading branch information
zainab-amir and syedsajjadkazmii authored Feb 27, 2024
1 parent e1f4898 commit e4ac128
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/register/RegistrationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
TPA_AUTHENTICATION_FAILURE,
} from './data/constants';
import {
DEFAULT_VARIATION,
FIRST_STEP,
getRegisterButtonLabelInExperiment,
NOT_INITIALIZED,
Expand Down Expand Up @@ -307,10 +308,13 @@ const RegistrationPage = (props) => {

const handleSubmit = (e) => {
e.preventDefault();
if (simplifyRegistrationExpVariation === SIMPLIFIED_REGISTRATION_VARIATION
|| simplifyRegistrationExpVariation === DEFAULT_VARIATION) {
trackSimplifyRegistrationContinueBtnClicked(simplifyRegistrationExpVariation);
}

if (simplifyRegistrationExpVariation === SIMPLIFIED_REGISTRATION_VARIATION
&& simplifiedRegisterPageStep === FIRST_STEP) {
trackSimplifyRegistrationContinueBtnClicked();
const { isValid, fieldErrors } = validateSimplifiedRegistrationFirstStepPayload(
formFields, errors, configurableFormFields, fieldDescriptions, formatMessage,
);
Expand Down
13 changes: 6 additions & 7 deletions src/register/data/optimizelyExperiment/track.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { sendTrackEvent } from '@edx/frontend-platform/analytics';

export const eventNames = {
/**
* sso button clicked
*/
simplifyRegistrationFirstStepViewed: 'edx.bi.user.simplifyregistration.step1.viewed', // page = first/second, variation,
simplifyRegistrationSecondStepViewed: 'edx.bi.user.simplifyregistration.step2.viewed', // page = first/second, variation,
simplifyRegistrationFirstStepViewed: 'edx.bi.user.simplifyregistration.step1.viewed',
simplifyRegistrationSecondStepViewed: 'edx.bi.user.simplifyregistration.step2.viewed',
simplifyRegistrationContinueBtnClicked: 'edx.bi.user.registration.submit.click',
};

Expand All @@ -21,6 +18,8 @@ export const trackSimplifyRegistrationSecondStepViewed = () => {
sendTrackEvent(eventNames.simplifyRegistrationSecondStepViewed, {});
};

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

0 comments on commit e4ac128

Please sign in to comment.