Skip to content

Commit 410efd3

Browse files
authored
Merge pull request Expensify#84654 from Expensify/youssef_fix_event_firing_twice
Fix GTM sign_up event firing twice
2 parents 1d618ff + c4f1375 commit 410efd3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import Overlay from './Overlay';
3838

3939
const Stack = createPlatformStackNavigator<OnboardingModalNavigatorParamList>();
4040

41+
let signUpEventPublishedForAccountID: number | undefined;
42+
4143
function OnboardingModalNavigator() {
4244
const styles = useThemeStyles();
4345
const {onboardingIsMediumOrLargerScreenWidth} = useResponsiveLayout();
@@ -68,10 +70,11 @@ function OnboardingModalNavigator() {
6870
// Publish a sign_up event when we start the onboarding flow. This should track basic sign ups
6971
// as well as Google and Apple SSO.
7072
useEffect(() => {
71-
if (!accountID) {
73+
if (!accountID || signUpEventPublishedForAccountID === accountID) {
7274
return;
7375
}
7476

77+
signUpEventPublishedForAccountID = accountID;
7578
GoogleTagManager.publishEvent(CONST.ANALYTICS.EVENT.SIGN_UP, accountID);
7679
}, [accountID]);
7780

0 commit comments

Comments
 (0)