Browse Source

Additional segment events (#4371)

* changed input params

---------

Co-authored-by: Artem <Artem Slugin>
attemka 1 year ago
parent
commit
87329949bd

+ 14 - 6
packages/atlas/src/MainLayout.tsx

@@ -59,6 +59,17 @@ export const MainLayout: FC = () => {
   const { trackPageView } = useSegmentAnalytics()
   const { trackPageView } = useSegmentAnalytics()
 
 
   useEffect(() => {
   useEffect(() => {
+    // had to include this timeout to make sure the page title is updated
+    const trackRequestTimeout = setTimeout(
+      () =>
+        trackPageView(
+          document.title,
+          'viewer',
+          (location.pathname === absoluteRoutes.viewer.ypp() && searchParams.get('referrer')) || undefined
+        ),
+      1000
+    )
+
     if (!atlasConfig.analytics.sentry?.dsn) {
     if (!atlasConfig.analytics.sentry?.dsn) {
       return
       return
     }
     }
@@ -74,12 +85,9 @@ export const MainLayout: FC = () => {
         stopReplay()
         stopReplay()
       }
       }
     }
     }
-
-    trackPageView(
-      location.pathname,
-      '',
-      (location.pathname === absoluteRoutes.viewer.ypp() && searchParams.get('referrer')) || undefined
-    )
+    return () => {
+      clearTimeout(trackRequestTimeout)
+    }
   }, [location.pathname, trackPageView, searchParams])
   }, [location.pathname, trackPageView, searchParams])
 
 
   const { clearOverlays } = useOverlayManager()
   const { clearOverlays } = useOverlayManager()

+ 4 - 1
packages/atlas/src/components/_auth/SignInModal/SignInModal.tsx

@@ -8,6 +8,7 @@ import { Button } from '@/components/_buttons/Button'
 import { DialogButtonProps } from '@/components/_overlays/Dialog'
 import { DialogButtonProps } from '@/components/_overlays/Dialog'
 import { atlasConfig } from '@/config'
 import { atlasConfig } from '@/config'
 import { FAUCET_URL } from '@/config/env'
 import { FAUCET_URL } from '@/config/env'
+import { useSegmentAnalytics } from '@/hooks/useSegmentAnalytics'
 import { MemberId } from '@/joystream-lib/types'
 import { MemberId } from '@/joystream-lib/types'
 import { hapiBnToTokenNumber } from '@/joystream-lib/utils'
 import { hapiBnToTokenNumber } from '@/joystream-lib/utils'
 import { useJoystream } from '@/providers/joystream/joystream.hooks'
 import { useJoystream } from '@/providers/joystream/joystream.hooks'
@@ -56,6 +57,7 @@ export const SignInModal: FC = () => {
   )
   )
 
 
   const { displaySnackbar } = useSnackbar()
   const { displaySnackbar } = useSnackbar()
+  const { identifyUser } = useSegmentAnalytics()
   const { walletStatus, refetchUserMemberships, setActiveUser, isLoggedIn } = useUser()
   const { walletStatus, refetchUserMemberships, setActiveUser, isLoggedIn } = useUser()
   const { signInModalOpen, setSignInModalOpen } = useUserStore(
   const { signInModalOpen, setSignInModalOpen } = useUserStore(
     (state) => ({ signInModalOpen: state.signInModalOpen, setSignInModalOpen: state.actions.setSignInModalOpen }),
     (state) => ({ signInModalOpen: state.signInModalOpen, setSignInModalOpen: state.actions.setSignInModalOpen }),
@@ -132,6 +134,7 @@ export const SignInModal: FC = () => {
           const lastCreatedMembership = data.memberships[data.memberships.length - 1]
           const lastCreatedMembership = data.memberships[data.memberships.length - 1]
           if (lastCreatedMembership) {
           if (lastCreatedMembership) {
             setActiveUser({ accountId: selectedAddress, memberId: lastCreatedMembership.id, channelId: null })
             setActiveUser({ accountId: selectedAddress, memberId: lastCreatedMembership.id, channelId: null })
+            identifyUser(lastCreatedMembership.id)
             displaySnackbar({
             displaySnackbar({
               title: 'Your membership has been created',
               title: 'Your membership has been created',
               description: 'Browse, watch, create, collect videos across the platform and have fun!',
               description: 'Browse, watch, create, collect videos across the platform and have fun!',
@@ -219,11 +222,11 @@ export const SignInModal: FC = () => {
       displaySnackbar,
       displaySnackbar,
       goToNextStep,
       goToNextStep,
       goToPreviousStep,
       goToPreviousStep,
+      identifyUser,
       joystream,
       joystream,
       refetchUserMemberships,
       refetchUserMemberships,
       selectedAddress,
       selectedAddress,
       setActiveUser,
       setActiveUser,
-      setPreviouslyFailedData,
       setSignInModalOpen,
       setSignInModalOpen,
     ]
     ]
   )
   )

+ 4 - 1
packages/atlas/src/components/_overlays/MemberDropdown/MemberDropdown.tsx

@@ -7,6 +7,7 @@ import { useTransition } from 'react-spring'
 import useResizeObserver from 'use-resize-observer'
 import useResizeObserver from 'use-resize-observer'
 
 
 import { absoluteRoutes } from '@/config/routes'
 import { absoluteRoutes } from '@/config/routes'
+import { useSegmentAnalytics } from '@/hooks/useSegmentAnalytics'
 import { getMemberAvatar } from '@/providers/assets/assets.helpers'
 import { getMemberAvatar } from '@/providers/assets/assets.helpers'
 import { useSubscribeAccountBalance } from '@/providers/joystream/joystream.hooks'
 import { useSubscribeAccountBalance } from '@/providers/joystream/joystream.hooks'
 import { useUser } from '@/providers/user/user.hooks'
 import { useUser } from '@/providers/user/user.hooks'
@@ -30,6 +31,7 @@ export const MemberDropdown = forwardRef<HTMLDivElement, MemberDropdownProps>(
     const navigate = useNavigate()
     const navigate = useNavigate()
     const { channelId, activeMembership, memberships, signOut, setActiveUser, setSignInModalOpen, membershipsLoading } =
     const { channelId, activeMembership, memberships, signOut, setActiveUser, setSignInModalOpen, membershipsLoading } =
       useUser()
       useUser()
+    const { identifyUser } = useSegmentAnalytics()
     const [showWithdrawDialog, setShowWithdrawDialog] = useState(false)
     const [showWithdrawDialog, setShowWithdrawDialog] = useState(false)
     const [disableScrollDuringAnimation, setDisableScrollDuringAnimation] = useState(false)
     const [disableScrollDuringAnimation, setDisableScrollDuringAnimation] = useState(false)
 
 
@@ -77,13 +79,14 @@ export const MemberDropdown = forwardRef<HTMLDivElement, MemberDropdownProps>(
     const handleMemberChange = useCallback(
     const handleMemberChange = useCallback(
       (memberId: string, accountId: string, channelId: string | null) => {
       (memberId: string, accountId: string, channelId: string | null) => {
         setActiveUser({ accountId, memberId, channelId })
         setActiveUser({ accountId, memberId, channelId })
+        identifyUser(memberId)
         setIsList(false)
         setIsList(false)
 
 
         if (publisher) {
         if (publisher) {
           navigate(absoluteRoutes.studio.index())
           navigate(absoluteRoutes.studio.index())
         }
         }
       },
       },
-      [navigate, publisher, setActiveUser]
+      [identifyUser, navigate, publisher, setActiveUser]
     )
     )
 
 
     const handleAddNewChannel = useCallback(() => {
     const handleAddNewChannel = useCallback(() => {

+ 42 - 12
packages/atlas/src/components/_video/VideoPlayer/VideoPlayer.tsx

@@ -20,6 +20,7 @@ import { SvgActionClose, SvgControlsCaptionsOutline, SvgControlsCaptionsSolid }
 import { Avatar } from '@/components/Avatar'
 import { Avatar } from '@/components/Avatar'
 import { absoluteRoutes } from '@/config/routes'
 import { absoluteRoutes } from '@/config/routes'
 import { useMediaMatch } from '@/hooks/useMediaMatch'
 import { useMediaMatch } from '@/hooks/useMediaMatch'
+import { useSegmentAnalytics, videoPlaybackParams } from '@/hooks/useSegmentAnalytics'
 import { usePersonalDataStore } from '@/providers/personalData'
 import { usePersonalDataStore } from '@/providers/personalData'
 import { isMobile } from '@/utils/browser'
 import { isMobile } from '@/utils/browser'
 import { ConsoleLogger, SentryLogger } from '@/utils/logs'
 import { ConsoleLogger, SentryLogger } from '@/utils/logs'
@@ -133,6 +134,12 @@ const VideoPlayerComponent: ForwardRefRenderFunction<HTMLVideoElement, VideoPlay
   const [isSharingOverlayOpen, setIsSharingOverlayOpen] = useState(false)
   const [isSharingOverlayOpen, setIsSharingOverlayOpen] = useState(false)
   const { height: playerHeight = 0 } = useResizeObserver({ box: 'border-box', ref: playerRef })
   const { height: playerHeight = 0 } = useResizeObserver({ box: 'border-box', ref: playerRef })
   const customControlsRef = useRef<HTMLDivElement>(null)
   const customControlsRef = useRef<HTMLDivElement>(null)
+  const {
+    trackVideoPlaybackResumed,
+    trackVideoPlaybackPaused,
+    trackVideoPlaybackStarted,
+    trackVideoPlaybackCompleted,
+  } = useSegmentAnalytics()
 
 
   const customControlsOffset =
   const customControlsOffset =
     ((customControlsRef.current?.getBoundingClientRect().top || 0) -
     ((customControlsRef.current?.getBoundingClientRect().top || 0) -
@@ -177,6 +184,18 @@ const VideoPlayerComponent: ForwardRefRenderFunction<HTMLVideoElement, VideoPlay
     )
     )
   }, [availableTextTracks, captionsLanguage, storedLanguageExists])
   }, [availableTextTracks, captionsLanguage, storedLanguageExists])
 
 
+  const videoPlaybackData = useMemo(
+    (): videoPlaybackParams => ({
+      videoId: videoId ?? 'no data',
+      channelId: video?.channel.id ?? 'no data',
+      title: video?.title ?? 'no data',
+      totalLength: video?.duration ?? -1,
+      fullScreen: isFullScreen,
+      quality: video?.mediaMetadata?.pixelHeight?.toString() ?? '1',
+    }),
+    [videoId, video?.channel.id, video?.title, video?.duration, isFullScreen, video?.mediaMetadata?.pixelHeight]
+  )
+
   const playVideo = useCallback(
   const playVideo = useCallback(
     async (player: VideoJsPlayer | null, withIndicator?: boolean, callback?: () => void) => {
     async (player: VideoJsPlayer | null, withIndicator?: boolean, callback?: () => void) => {
       if (!player) {
       if (!player) {
@@ -186,6 +205,9 @@ const VideoPlayerComponent: ForwardRefRenderFunction<HTMLVideoElement, VideoPlay
       try {
       try {
         setNeedsManualPlay(false)
         setNeedsManualPlay(false)
         const playPromise = await player.play()
         const playPromise = await player.play()
+        if (playPromise) {
+          trackVideoPlaybackResumed(videoPlaybackData)
+        }
         if (playPromise && callback) callback()
         if (playPromise && callback) callback()
       } catch (error) {
       } catch (error) {
         if (error.name === 'AbortError') {
         if (error.name === 'AbortError') {
@@ -204,17 +226,21 @@ const VideoPlayerComponent: ForwardRefRenderFunction<HTMLVideoElement, VideoPlay
         }
         }
       }
       }
     },
     },
-    [videoId, videoJsConfig.videoUrls]
+    [trackVideoPlaybackResumed, videoId, videoPlaybackData, videoJsConfig.videoUrls]
   )
   )
 
 
-  const pauseVideo = useCallback((player: VideoJsPlayer | null, withIndicator?: boolean, callback?: () => void) => {
-    if (!player) {
-      return
-    }
-    withIndicator && player.trigger(CustomVideojsEvents.PauseControl)
-    callback?.()
-    player.pause()
-  }, [])
+  const pauseVideo = useCallback(
+    (player: VideoJsPlayer | null, withIndicator?: boolean, callback?: () => void) => {
+      if (!player) {
+        return
+      }
+      withIndicator && player.trigger(CustomVideojsEvents.PauseControl)
+      callback?.()
+      player.pause()
+      trackVideoPlaybackPaused(videoPlaybackData)
+    },
+    [trackVideoPlaybackPaused, videoPlaybackData]
+  )
 
 
   useEffect(() => {
   useEffect(() => {
     if (!isVideoPending) {
     if (!isVideoPending) {
@@ -335,12 +361,13 @@ const VideoPlayerComponent: ForwardRefRenderFunction<HTMLVideoElement, VideoPlay
     }
     }
     const handler = () => {
     const handler = () => {
       setPlayerState('ended')
       setPlayerState('ended')
+      trackVideoPlaybackCompleted(videoPlaybackData)
     }
     }
     player.on('ended', handler)
     player.on('ended', handler)
     return () => {
     return () => {
       player.off('ended', handler)
       player.off('ended', handler)
     }
     }
-  }, [nextVideo, player])
+  }, [nextVideo, player, trackVideoPlaybackCompleted, videoPlaybackData])
 
 
   // handle loadstart
   // handle loadstart
   useEffect(() => {
   useEffect(() => {
@@ -367,13 +394,14 @@ const VideoPlayerComponent: ForwardRefRenderFunction<HTMLVideoElement, VideoPlay
         .then(() => {
         .then(() => {
           onAddVideoView?.()
           onAddVideoView?.()
           setIsPlaying(true)
           setIsPlaying(true)
+          trackVideoPlaybackStarted(videoPlaybackData)
         })
         })
         .catch((e) => {
         .catch((e) => {
           setNeedsManualPlay(true)
           setNeedsManualPlay(true)
           ConsoleLogger.warn('Video autoplay failed', e)
           ConsoleLogger.warn('Video autoplay failed', e)
         })
         })
     }
     }
-  }, [player, isLoaded, autoplay, onAddVideoView])
+  }, [player, isLoaded, autoplay, onAddVideoView, trackVideoPlaybackStarted, videoPlaybackData])
 
 
   // handle playing and pausing from outside the component
   // handle playing and pausing from outside the component
   useEffect(() => {
   useEffect(() => {
@@ -382,10 +410,12 @@ const VideoPlayerComponent: ForwardRefRenderFunction<HTMLVideoElement, VideoPlay
     }
     }
     if (playing) {
     if (playing) {
       playVideo(player)
       playVideo(player)
+      trackVideoPlaybackResumed(videoPlaybackData)
     } else {
     } else {
       player.pause()
       player.pause()
+      trackVideoPlaybackPaused(videoPlaybackData)
     }
     }
-  }, [playVideo, player, playing])
+  }, [playVideo, player, playing, trackVideoPlaybackPaused, trackVideoPlaybackResumed, videoPlaybackData])
 
 
   // handle playing and pausing
   // handle playing and pausing
   useEffect(() => {
   useEffect(() => {

+ 57 - 9
packages/atlas/src/hooks/useSegmentAnalytics.ts

@@ -2,9 +2,25 @@ import { useCallback } from 'react'
 
 
 import useSegmentAnalyticsContext from '@/providers/segmentAnalytics/useSegmentAnalyticsContext'
 import useSegmentAnalyticsContext from '@/providers/segmentAnalytics/useSegmentAnalyticsContext'
 
 
+export type videoPlaybackParams = {
+  videoId: string
+  channelId: string
+  title: string
+  totalLength: number
+  fullScreen: boolean
+  quality: string
+}
+
 export const useSegmentAnalytics = () => {
 export const useSegmentAnalytics = () => {
   const { analytics } = useSegmentAnalyticsContext()
   const { analytics } = useSegmentAnalyticsContext()
 
 
+  const identifyUser = useCallback(
+    (email: string) => {
+      analytics.identify({ email })
+    },
+    [analytics]
+  )
+
   const trackPageView = useCallback(
   const trackPageView = useCallback(
     (name: string, category = 'App', referrer = 'no data') => {
     (name: string, category = 'App', referrer = 'no data') => {
       analytics.page(category, name, {
       analytics.page(category, name, {
@@ -47,14 +63,37 @@ export const useSegmentAnalytics = () => {
     [analytics]
     [analytics]
   )
   )
 
 
-  const trackVideoView = useCallback(
-    (videoId: string, channelId: string, channelTitle: string, description: string, isNft: boolean) => {
-      analytics.track('video viewed', {
-        videoId,
-        channelId,
-        channelTitle,
-        description,
-        isNft,
+  const trackVideoPlaybackStarted = useCallback(
+    (params: videoPlaybackParams) => {
+      analytics.track('video playback started', {
+        ...params,
+      })
+    },
+    [analytics]
+  )
+
+  const trackVideoPlaybackPaused = useCallback(
+    (params: videoPlaybackParams) => {
+      analytics.track('video playback paused', {
+        ...params,
+      })
+    },
+    [analytics]
+  )
+
+  const trackVideoPlaybackResumed = useCallback(
+    (params: videoPlaybackParams) => {
+      analytics.track('video playback resumed', {
+        ...params,
+      })
+    },
+    [analytics]
+  )
+
+  const trackVideoPlaybackCompleted = useCallback(
+    (params: videoPlaybackParams) => {
+      analytics.track('video playback completed', {
+        ...params,
       })
       })
     },
     },
     [analytics]
     [analytics]
@@ -129,12 +168,20 @@ export const useSegmentAnalytics = () => {
     [analytics]
     [analytics]
   )
   )
 
 
+  const trackYppSignInButtonClick = useCallback(() => {
+    analytics.track('YPP Landing Sign In w Google Clicked')
+  }, [analytics])
+
   return {
   return {
+    identifyUser,
     trackPageView,
     trackPageView,
     trackYppOptIn,
     trackYppOptIn,
     trackAccountCreation,
     trackAccountCreation,
     trackChannelCreation,
     trackChannelCreation,
-    trackVideoView,
+    trackVideoPlaybackStarted,
+    trackVideoPlaybackPaused,
+    trackVideoPlaybackResumed,
+    trackVideoPlaybackCompleted,
     trackVideoUpload,
     trackVideoUpload,
     trackNftMint,
     trackNftMint,
     trackNftSale,
     trackNftSale,
@@ -142,5 +189,6 @@ export const useSegmentAnalytics = () => {
     trackLikeAdded,
     trackLikeAdded,
     trackDislikeAdded,
     trackDislikeAdded,
     trackChannelFollow,
     trackChannelFollow,
+    trackYppSignInButtonClick,
   }
   }
 }
 }

+ 1 - 2
packages/atlas/src/providers/uploads/uploads.manager.tsx

@@ -73,9 +73,8 @@ export const UploadsManager: FC = () => {
             actionText: 'See on Joystream',
             actionText: 'See on Joystream',
             onActionClick: () => openInNewTab(absoluteRoutes.viewer.video(video.parentObject.id), true),
             onActionClick: () => openInNewTab(absoluteRoutes.viewer.video(video.parentObject.id), true),
           })
           })
+          trackVideoUpload(video.parentObject?.title ?? 'no data', channelId ?? 'no data')
         }
         }
-
-        trackVideoUpload(video.parentObject?.title ?? 'no data', channelId ?? 'no data')
       })
       })
       videoAssetsRef.current = videoAssets
       videoAssetsRef.current = videoAssets
     }
     }

+ 13 - 1
packages/atlas/src/views/global/YppLandingView/YppLandingView.tsx

@@ -10,6 +10,7 @@ import { YppReferralBanner } from '@/components/_ypp/YppReferralBanner'
 import { atlasConfig } from '@/config'
 import { atlasConfig } from '@/config'
 import { absoluteRoutes } from '@/config/routes'
 import { absoluteRoutes } from '@/config/routes'
 import { useHeadTags } from '@/hooks/useHeadTags'
 import { useHeadTags } from '@/hooks/useHeadTags'
+import { useSegmentAnalytics } from '@/hooks/useSegmentAnalytics'
 import { useSnackbar } from '@/providers/snackbars'
 import { useSnackbar } from '@/providers/snackbars'
 import { useUser } from '@/providers/user/user.hooks'
 import { useUser } from '@/providers/user/user.hooks'
 import { useYppStore } from '@/providers/ypp/ypp.store'
 import { useYppStore } from '@/providers/ypp/ypp.store'
@@ -34,6 +35,7 @@ export const YppLandingView: FC = () => {
   const { setSelectedChannelId, setShouldContinueYppFlow } = useYppStore((store) => store.actions)
   const { setSelectedChannelId, setShouldContinueYppFlow } = useYppStore((store) => store.actions)
   const { displaySnackbar } = useSnackbar()
   const { displaySnackbar } = useSnackbar()
   const navigate = useNavigate()
   const navigate = useNavigate()
+  const { trackYppSignInButtonClick } = useSegmentAnalytics()
   const selectedChannelTitle = activeMembership?.channels.find((channel) => channel.id === channelId)?.title
   const selectedChannelTitle = activeMembership?.channels.find((channel) => channel.id === channelId)?.title
   const { data } = useQuery('ypp-quota-fetch', () =>
   const { data } = useQuery('ypp-quota-fetch', () =>
     axios
     axios
@@ -68,6 +70,7 @@ export const YppLandingView: FC = () => {
     }
     }
 
 
     if (!isLoggedIn) {
     if (!isLoggedIn) {
+      trackYppSignInButtonClick()
       await signIn()
       await signIn()
       setWasSignInTriggered(true)
       setWasSignInTriggered(true)
       return
       return
@@ -82,7 +85,16 @@ export const YppLandingView: FC = () => {
       setCurrentStep('requirements')
       setCurrentStep('requirements')
       return
       return
     }
     }
-  }, [currentStep, displaySnackbar, isLoggedIn, isTodaysQuotaReached, isYppSigned, navigate, signIn])
+  }, [
+    currentStep,
+    displaySnackbar,
+    isLoggedIn,
+    isTodaysQuotaReached,
+    isYppSigned,
+    navigate,
+    signIn,
+    trackYppSignInButtonClick,
+  ])
 
 
   useEffect(() => {
   useEffect(() => {
     // rerun handleYppSignUpClick after sign in flow
     // rerun handleYppSignUpClick after sign in flow

+ 9 - 0
packages/atlas/src/views/studio/StudioLayout.tsx

@@ -14,6 +14,7 @@ import { SidenavStudio } from '@/components/_navigation/SidenavStudio'
 import { TopbarStudio } from '@/components/_navigation/TopbarStudio'
 import { TopbarStudio } from '@/components/_navigation/TopbarStudio'
 import { atlasConfig } from '@/config'
 import { atlasConfig } from '@/config'
 import { absoluteRoutes, relativeRoutes } from '@/config/routes'
 import { absoluteRoutes, relativeRoutes } from '@/config/routes'
+import { useSegmentAnalytics } from '@/hooks/useSegmentAnalytics'
 import { useConfirmationModal } from '@/providers/confirmationModal'
 import { useConfirmationModal } from '@/providers/confirmationModal'
 import { ConnectionStatusManager, useConnectionStatusStore } from '@/providers/connectionStatus'
 import { ConnectionStatusManager, useConnectionStatusStore } from '@/providers/connectionStatus'
 import { UploadsManager } from '@/providers/uploads/uploads.manager'
 import { UploadsManager } from '@/providers/uploads/uploads.manager'
@@ -49,6 +50,7 @@ const StudioLayout = () => {
 
 
   const [openUnsupportedBrowserDialog, closeUnsupportedBrowserDialog] = useConfirmationModal()
   const [openUnsupportedBrowserDialog, closeUnsupportedBrowserDialog] = useConfirmationModal()
   const [enterLocation] = useState(location.pathname)
   const [enterLocation] = useState(location.pathname)
+  const { trackPageView } = useSegmentAnalytics()
   const isMembershipLoaded = !membershipsLoading && !isAuthLoading && !isWalletLoading
   const isMembershipLoaded = !membershipsLoading && !isAuthLoading && !isWalletLoading
   const hasMembership = !!memberships?.length
   const hasMembership = !!memberships?.length
 
 
@@ -77,6 +79,13 @@ const StudioLayout = () => {
     }
     }
   }, [closeUnsupportedBrowserDialog, openUnsupportedBrowserDialog])
   }, [closeUnsupportedBrowserDialog, openUnsupportedBrowserDialog])
 
 
+  useEffect(() => {
+    // had to include this timeout to make sure the page title is updated
+    const trackRequestTimeout = setTimeout(() => trackPageView(document.title, 'studio', undefined), 1000)
+
+    return () => clearTimeout(trackRequestTimeout)
+  }, [location.pathname, trackPageView])
+
   const yppRedirect = useCallback(() => {
   const yppRedirect = useCallback(() => {
     if (!channelSet) {
     if (!channelSet) {
       return ENTRY_POINT_ROUTE
       return ENTRY_POINT_ROUTE

+ 2 - 13
packages/atlas/src/views/viewer/VideoView/VideoView.tsx

@@ -96,7 +96,7 @@ export const VideoView: FC = () => {
   const nftWidgetProps = useNftWidget(video)
   const nftWidgetProps = useNftWidget(video)
   const { likeOrDislikeVideo } = useReactionTransactions()
   const { likeOrDislikeVideo } = useReactionTransactions()
   const { withdrawBid } = useNftTransactions()
   const { withdrawBid } = useNftTransactions()
-  const { trackVideoView, trackLikeAdded, trackDislikeAdded } = useSegmentAnalytics()
+  const { trackLikeAdded, trackDislikeAdded } = useSegmentAnalytics()
 
 
   const mdMatch = useMediaMatch('md')
   const mdMatch = useMediaMatch('md')
   const { addVideoView } = useAddVideoView()
   const { addVideoView } = useAddVideoView()
@@ -162,7 +162,6 @@ export const VideoView: FC = () => {
   const channelId = video?.channel?.id
   const channelId = video?.channel?.id
   const channelName = video?.channel?.title
   const channelName = video?.channel?.title
   const videoId = video?.id
   const videoId = video?.id
-  const videoDescription = video?.description
   const numberOfLikes = video?.reactions.filter(({ reaction }) => reaction === 'LIKE').length
   const numberOfLikes = video?.reactions.filter(({ reaction }) => reaction === 'LIKE').length
   const numberOfDislikes = video?.reactions.filter(({ reaction }) => reaction === 'UNLIKE').length
   const numberOfDislikes = video?.reactions.filter(({ reaction }) => reaction === 'UNLIKE').length
   const videoNotAvailable = !loading && !video
   const videoNotAvailable = !loading && !video
@@ -270,8 +269,6 @@ export const VideoView: FC = () => {
     setShareDialogOpen(true)
     setShareDialogOpen(true)
   }
   }
 
 
-  const isNft = !!nftWidgetProps
-
   const handleAddVideoView = useCallback(() => {
   const handleAddVideoView = useCallback(() => {
     if (!videoId || !channelId) {
     if (!videoId || !channelId) {
       return
       return
@@ -283,15 +280,7 @@ export const VideoView: FC = () => {
     }).catch((error) => {
     }).catch((error) => {
       SentryLogger.error('Failed to increase video views', 'VideoView', error)
       SentryLogger.error('Failed to increase video views', 'VideoView', error)
     })
     })
-
-    trackVideoView(
-      videoId ?? 'no data',
-      channelId ?? 'no data',
-      channelName ?? 'no data',
-      videoDescription ?? 'no data',
-      isNft
-    )
-  }, [videoId, channelId, addVideoView, trackVideoView, channelName, videoDescription, isNft])
+  }, [videoId, channelId, addVideoView])
 
 
   if (error) {
   if (error) {
     return <ViewErrorFallback />
     return <ViewErrorFallback />