manifold/web/hooks/use-tracking.ts
2022-09-06 22:43:28 -05:00

15 lines
352 B
TypeScript

import { track } from '@amplitude/analytics-browser'
import { useEffect } from 'react'
import { inIframe } from './use-is-iframe'
export const useTracking = (
eventName: string,
eventProperties?: any,
excludeIframe?: boolean
) => {
useEffect(() => {
if (excludeIframe && inIframe()) return
track(eventName, eventProperties)
}, [])
}