Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NoQA] Add environment as an identifying property for Fullstory #43194

Merged
merged 5 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
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
11 changes: 8 additions & 3 deletions src/libs/Fullstory/index.native.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import FullStory, {FSPage} from '@fullstory/react-native';
import type {OnyxEntry} from 'react-native-onyx';
import * as Environment from '@src/libs/Environment/Environment';
import type {UserMetadata} from '@src/types/onyx';

/**
Expand Down Expand Up @@ -40,9 +41,13 @@ const FS = {
// anonymize FullStory user identity metadata
FullStory.anonymize();
} else {
// define FullStory user identity
FullStory.identify(String(metadata.accountID), {
properties: metadata,
Environment.getEnvironment().then((envName: string) => {
// define FullStory user identity
const localMetadata = metadata;
localMetadata.environment = envName;
FullStory.identify(String(localMetadata.accountID), {
Copy link
Contributor

Choose a reason for hiding this comment

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

I love that you used the localMetadata here

properties: localMetadata,
});
});
}
},
Expand Down
6 changes: 5 additions & 1 deletion src/libs/Fullstory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ const FS = {
}
FS.onReady().then(() => {
FS.consent(true);
FS.fsIdentify(value);
if (value) {
const localMetadata = value;
localMetadata.environment = envName;
FS.fsIdentify(localMetadata);
}
});
});
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions src/types/onyx/UserMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ type UserMetadata = {
role?: string;
freeTrial?: boolean;
accountID?: number;
environment?: string;
};

export default UserMetadata;
Loading