Skip to content

Commit 33a1adf

Browse files
author
FalkWolsky
committed
Adding Posthog Login Event
1 parent 162facc commit 33a1adf

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

client/packages/lowcoder/src/app.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ class AppIndex extends React.Component<AppIndexProps, any> {
130130
// make sure all users in this app have checked login info
131131
if (!this.props.isFetchUserFinished || (this.props.currentUserId && !this.props.fetchHomeDataFinished)) {
132132
const hideLoadingHeader = isTemplate || isAuthUnRequired(pathname);
133+
// if the user just logged in, we send the event to posthog
134+
if (sessionStorage.getItem('_just_logged_in_')) {
135+
posthog.identify(this.props.currentUserId);
136+
sessionStorage.removeItem('_just_logged_in_');
137+
}
133138
return <ProductLoading hideHeader={hideLoadingHeader} />;
134139
}
135140

client/packages/lowcoder/src/pages/userAuth/authUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export function authRespValidate(
8282

8383
if (doValidResponse(resp)) {
8484
onAuthSuccess?.();
85+
sessionStorage.setItem("_just_logged_in_", "true");
8586
history.replace(replaceUrl.replace(baseUrl, ''));
8687
} else if (
8788
resp.data.code === SERVER_ERROR_CODES.EXCEED_MAX_USER_ORG_COUNT ||

0 commit comments

Comments
 (0)