Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions app/client/src/utils/AppsmithUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,23 @@ export const initializeAnalyticsAndTrackers = async (currentUser: User) => {
if (appsmithConfigs.segment.enabled && !(window as any).analytics) {
if (appsmithConfigs.segment.apiKey) {
// This value is only enabled for Appsmith's cloud hosted version. It is not set in self-hosted environments
return AnalyticsUtil.initializeSegment(appsmithConfigs.segment.apiKey);
await AnalyticsUtil.initializeSegment(appsmithConfigs.segment.apiKey);
} else if (appsmithConfigs.segment.ceKey) {
// This value is set in self-hosted environments. But if the analytics are disabled, it's never used.
return AnalyticsUtil.initializeSegment(appsmithConfigs.segment.ceKey);
await AnalyticsUtil.initializeSegment(appsmithConfigs.segment.ceKey);
}
}

if (
!currentUser.isAnonymous &&
currentUser.username !== ANONYMOUS_USERNAME
) {
await AnalyticsUtil.identifyUser(currentUser);
}
Comment on lines +107 to +113
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

User identification is duplicated in HelpButton.tsx

Found another instance of identifyUser being called in app/client/src/pages/Editor/HelpButton.tsx. This could lead to duplicate user identification.

  • app/client/src/utils/AppsmithUtils.tsx: Main identification call
  • app/client/src/pages/Editor/HelpButton.tsx: Duplicate identification call with sendAdditionalData flag
🔗 Analysis chain

LGTM! User identification logic properly placed.

The user identification is now correctly placed within the analytics setup try-catch block and executes after segment initialization.

Let's verify that this is the only place where user identification is called:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of identifyUser to ensure we're not duplicating the call
rg "identifyUser" --type ts --type tsx

Length of output: 66


Script:

#!/bin/bash
# Search for identifyUser occurrences using ripgrep with correct file type options
rg "identifyUser" -t ts -t tsx -t js -t jsx

Length of output: 71


Script:

#!/bin/bash
# Search for identifyUser using basic ripgrep without file type filters
rg "identifyUser"

# Also search for the AnalyticsUtil class usage
rg "AnalyticsUtil"

Length of output: 78941

} catch (e) {
Sentry.captureException(e);
log.error(e);
}

if (!currentUser.isAnonymous && currentUser.username !== ANONYMOUS_USERNAME) {
await AnalyticsUtil.identifyUser(currentUser);
}
};

export const mapToPropList = (map: Record<string, string>): Property[] => {
Expand Down