2023-06-26 12:36:15 +03:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
|
|
|
|
|
|
|
import { useJune } from "./useJune";
|
|
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
|
export const useEventTracking = () => {
|
|
|
|
const analytics = useJune();
|
|
|
|
const { session } = useSupabase();
|
|
|
|
|
2023-06-26 13:54:07 +03:00
|
|
|
const track = async (event: string): Promise<void> => {
|
2023-06-26 23:11:10 +03:00
|
|
|
await analytics?.identify(session?.user.id, {email: session?.user.email});
|
2023-06-26 12:36:15 +03:00
|
|
|
await analytics?.track(event);
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
track,
|
|
|
|
};
|
|
|
|
};
|