Skip to content

Commit

Permalink
added tracking hook for auth2
Browse files Browse the repository at this point in the history
  • Loading branch information
iskounen committed Oct 21, 2024
1 parent 89d15d6 commit 71dd70e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/app/Scenes/Onboarding/Auth2/components/AuthModal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { AuthImpression, ActionType } from "@artsy/cohesion"
import { Box, Flex, useTheme } from "@artsy/palette-mobile"
import { AuthContext } from "app/Scenes/Onboarding/Auth2/AuthContext"
import { useOnboardingAuth2Tracking } from "app/Scenes/Onboarding/Auth2/hooks/useOnboardingAuth2Tracking"
import { MotiView } from "moti"
import { useEffect, useMemo } from "react"
import { Dimensions } from "react-native"
import { Easing } from "react-native-reanimated"
import { useSafeAreaInsets } from "react-native-safe-area-context"
import { useTracking } from "react-tracking"

const HEIGHT = {
LoginWelcomeStep: 320,
Expand All @@ -26,10 +25,10 @@ export const AuthModal: React.FC = ({ children }) => {
const { color, space } = useTheme()
const insets = useSafeAreaInsets()

const tracking = useTracking()
const tracking = useOnboardingAuth2Tracking()

useEffect(() => {
tracking.trackEvent(tracks.authImpression())
tracking.authImpression()
}, [])

const screenHeight = Dimensions.get("window").height
Expand Down Expand Up @@ -82,10 +81,3 @@ export const AuthModal: React.FC = ({ children }) => {
// </KeyboardAvoidingView>
)
}

const tracks = {
authImpression: (): Partial<AuthImpression> => ({
action: ActionType.authImpression,
trigger: "tap",
}),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ActionType, AuthImpression } from "@artsy/cohesion"
import { useTracking } from "react-tracking"

export const useOnboardingAuth2Tracking = () => {
const { trackEvent } = useTracking()

return {
authImpression: () => {
const payload: Partial<AuthImpression> = {
action: ActionType.authImpression,
trigger: "tap",
}

trackEvent(payload)
},
}
}

0 comments on commit 71dd70e

Please sign in to comment.