Ich habe soweit automatisiert the Emails sortieren aber ich muss noch schauen was es fur bugs es gibt wenn die app online ist deswegen wurde ich mit diesen Commit die website veroffentlichen obwohjl es sein konnte das es noch nicht fertig ist und verkaufs bereit
54 lines
1.0 KiB
TypeScript
54 lines
1.0 KiB
TypeScript
/**
|
|
* React Hook for Analytics
|
|
* Provides easy access to analytics functions in components
|
|
*/
|
|
|
|
import { useEffect } from 'react'
|
|
import { useLocation } from 'react-router-dom'
|
|
import {
|
|
trackPageView,
|
|
captureUTMParams,
|
|
getAllTrackingParams,
|
|
trackSignup,
|
|
trackTrialStart,
|
|
trackPurchase,
|
|
trackEmailConnected,
|
|
setUserId,
|
|
type TrackingParams,
|
|
} from '@/lib/analytics'
|
|
|
|
/**
|
|
* Hook to automatically track page views on route changes
|
|
*/
|
|
export function usePageTracking() {
|
|
const location = useLocation()
|
|
|
|
useEffect(() => {
|
|
// Capture UTM parameters on every navigation
|
|
captureUTMParams()
|
|
|
|
// Track page view
|
|
trackPageView(location.pathname)
|
|
}, [location])
|
|
}
|
|
|
|
/**
|
|
* Hook to get tracking parameters
|
|
*/
|
|
export function useTrackingParams(): TrackingParams {
|
|
return getAllTrackingParams()
|
|
}
|
|
|
|
/**
|
|
* Export analytics functions for use in components
|
|
*/
|
|
export const analytics = {
|
|
trackSignup,
|
|
trackTrialStart,
|
|
trackPurchase,
|
|
trackEmailConnected,
|
|
setUserId,
|
|
}
|
|
|
|
export default usePageTracking
|