diff --git a/src/helpers/analytics.ts b/src/helpers/analytics.ts index baa0126..c300d1f 100644 --- a/src/helpers/analytics.ts +++ b/src/helpers/analytics.ts @@ -1,12 +1,17 @@ import { getLogger } from "helpers/logger"; +import { TrackingFunction } from "types/global"; const logger = getLogger("📊 [Analytics]"); -export const sendAnalytics = (category: string, event: string): void => { +export const sendAnalytics = ( + category: string, + event: Parameters[0], + data?: Parameters[1] +): void => { const eventName = `[${category}] ${event}`; logger.log(eventName); try { - umami(eventName); + umami.track(eventName, data); } catch (error) { if (error instanceof ReferenceError) return; logger.error(error); diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index bc5977b..f81fe54 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -38,8 +38,9 @@ const AccordsLibraryApp = (props: AppProps): JSX.Element => {