Skip to content

Commit

Permalink
fix: update custom fields to be set with user data [WPB-14522] (#18689)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-maad authored Jan 29, 2025
1 parent 6f3529f commit b29309f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
17 changes: 7 additions & 10 deletions src/script/tracking/EventTrackingRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,9 @@ export class EventTrackingRepository {
}
}

private getCommonSegmentation(): ContributedSegmentations {
private getUserData(): ContributedSegmentations {
const segmentation: ContributedSegmentations = {
[Segmentation.APP_OPEN.DESKTOP_APP]: getPlatform(),
[Segmentation.APP_OPEN.APP_VERSION]: Config.getConfig().VERSION,
[Segmentation.APP_OPEN.OS_VERSION]: navigator.userAgent,
[Segmentation.APP_OPEN.IS_TEAM_MEMBER]: this.teamState.isTeam(),
[Segmentation.COMMON.TEAM_IS_TEAM]: this.teamState.isTeam(),
[UserData.IS_TEAM]: this.teamState.isTeam(),
};

if (this.teamState.isTeam()) {
Expand All @@ -354,16 +350,17 @@ export class EventTrackingRepository {
}

if (this.isProductReportingActivated === true || getForcedErrorReportingStatus()) {
const userData = {
[UserData.IS_TEAM]: this.teamState.isTeam(),
};
const userData = this.getUserData();

telemetry.setUserData(userData);

this.telemetryLogger.info(`Reporting user data for product event ${eventName}@${JSON.stringify(userData)}`);

const segmentation = {
...this.getCommonSegmentation(),
[Segmentation.APP_OPEN.DESKTOP_APP]: getPlatform(),
[Segmentation.APP_OPEN.APP_VERSION]: Config.getConfig().VERSION,
[Segmentation.APP_OPEN.OS_VERSION]: navigator.userAgent,
[Segmentation.APP_OPEN.IS_TEAM_MEMBER]: this.teamState.isTeam(),
...customSegmentations,
};

Expand Down
1 change: 0 additions & 1 deletion src/script/tracking/Segmentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const Segmentation = {
VIDEO: 'call_video',
},
COMMON: {
TEAM_IS_TEAM: 'team_is_team',
TEAM_IS_ENTERPRISE: 'team_is_enterprise',
TEAM_TEAM_ID: 'team_team_id',
TEAM_TEAM_SIZE: 'team_team_size',
Expand Down

0 comments on commit b29309f

Please sign in to comment.