Skip to content

Commit

Permalink
feat: add account creation page events (SigNoz#3619)
Browse files Browse the repository at this point in the history
  • Loading branch information
YounixM authored and manishm committed Sep 27, 2023
1 parent a84077d commit 2d58438
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions frontend/src/pages/SignUp/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useLocation } from 'react-router-dom';
import { SuccessResponse } from 'types/api';
import { PayloadProps } from 'types/api/user/getUser';
import { PayloadProps as LoginPrecheckPayloadProps } from 'types/api/user/loginPrecheck';
import { trackEvent } from 'utils/segmentAnalytics';

import {
ButtonContainer,
Expand Down Expand Up @@ -84,6 +85,13 @@ function SignUp({ version }: SignUpProps): JSX.Element {
form.setFieldValue('email', responseDetails.email);
form.setFieldValue('organizationName', responseDetails.organization);
setIsDetailsDisable(true);

trackEvent('Account Creation Page Visited', {
email: responseDetails.email,
name: responseDetails.name,
company_name: responseDetails.organization,
source: 'SigNoz Cloud',
});
}
}, [
getInviteDetailsResponse.data?.payload,
Expand Down Expand Up @@ -230,6 +238,10 @@ function SignUp({ version }: SignUpProps): JSX.Element {
setLoading(true);

if (!isPasswordValid(values.password)) {
trackEvent('Account Creation Page - Invalid Password', {
email: values.email,
name: values.firstName,
});
setIsPasswordPolicyError(true);
setLoading(false);
return;
Expand All @@ -238,6 +250,11 @@ function SignUp({ version }: SignUpProps): JSX.Element {
if (isPreferenceVisible) {
await commonHandler(values, onAdminAfterLogin);
} else {
trackEvent('Account Created Successfully', {
email: values.email,
name: values.firstName,
});

await commonHandler(
values,
async (): Promise<void> => {
Expand Down

0 comments on commit 2d58438

Please sign in to comment.