Refactor analytics

pull/3904/head
Kamran Ahmed 2 years ago
parent 9e37076d0d
commit 7a8d97b1cd
  1. 16
      src/components/Analytics/analytics.ts

@ -1,20 +1,14 @@
export { };
declare global {
interface Window {
// To selectively enable/disable debug logs
__DEBUG__: boolean;
gtag: any;
fireEvent: (props: GAEventType) => void;
}
}
export type GAEventType = {
fireEvent: (props: {
action: string;
category: string;
label?: string;
value?: string;
};
}) => void;
}
}
/**
* Tracks the event on google analytics
@ -22,7 +16,7 @@ export type GAEventType = {
* @param props Event properties
* @returns void
*/
window.fireEvent = (props: GAEventType) => {
window.fireEvent = (props) => {
const { action, category, label, value } = props;
if (!window.gtag) {
console.warn('Missing GTAG - Analytics disabled');

Loading…
Cancel
Save