From 3c1b7bbeb265a07904c0608e685f13b9f606f270 Mon Sep 17 00:00:00 2001 From: Pawan Jain Date: Thu, 18 Apr 2024 18:06:34 +0530 Subject: [PATCH] feat: add mobile condition with modal --- .../quick-start/components/OnboardingExperimentModal.tsx | 9 ++++++++- apps/web/src/pages/quick-start/steps/GetStarted.tsx | 9 ++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/web/src/pages/quick-start/components/OnboardingExperimentModal.tsx b/apps/web/src/pages/quick-start/components/OnboardingExperimentModal.tsx index e02139bcea6..b1791aeef8d 100644 --- a/apps/web/src/pages/quick-start/components/OnboardingExperimentModal.tsx +++ b/apps/web/src/pages/quick-start/components/OnboardingExperimentModal.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { Modal, useMantineTheme, Grid } from '@mantine/core'; import styled from '@emotion/styled'; @@ -22,6 +22,13 @@ export function OnboardingExperimentModal() { setOpened(true); }; + useEffect(() => { + segment.track('Welcome modal open - [Onboarding]', { + experiment_id: '2024-w15-onb', + _organization: currentOrganization?._id, + }); + }, [currentOrganization?._id, segment]); + return ( ({ open: false }); - const isOnboardingModalEnabled = localStorage.getItem(OnboardingExperimentV2ModalKey) === 'true'; + const isOnboardingModalEnabled = + localStorage.getItem(OnboardingExperimentV2ModalKey) === 'true' && window.innerWidth > 768; const onIntegrationModalClose = () => setClickedChannel({ open: false }); useEffect(() => { segment.track(OnBoardingAnalyticsEnum.CONFIGURE_PROVIDER_VISIT); - if (isOnboardingModalEnabled) { - segment.track('Welcome modal open - [Onboarding]', { - experiment_id: '2024-w15-onb', - _organization: currentOrganization?._id, - }); - } }, [currentOrganization?._id, isOnboardingModalEnabled, segment]); function handleOnClick() {