2020-12-20 04:08:22 -08:00
|
|
|
export const trackEvent =
|
2021-01-05 20:06:14 +02:00
|
|
|
process.env.REACT_APP_GOOGLE_ANALYTICS_ID &&
|
|
|
|
typeof window !== "undefined" &&
|
|
|
|
window.gtag
|
2020-12-20 04:08:22 -08:00
|
|
|
? (category: string, name: string, label?: string, value?: number) => {
|
|
|
|
window.gtag("event", name, {
|
|
|
|
event_category: category,
|
|
|
|
event_label: label,
|
|
|
|
value,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
: typeof process !== "undefined" && process?.env?.JEST_WORKER_ID
|
|
|
|
? (category: string, name: string, label?: string, value?: number) => {}
|
|
|
|
: (category: string, name: string, label?: string, value?: number) => {
|
2021-01-05 20:06:14 +02:00
|
|
|
// Uncomment the next line to track locally
|
|
|
|
// console.info("Track Event", category, name, label, value);
|
2020-12-20 04:08:22 -08:00
|
|
|
};
|