excalidraw/src/analytics.ts

25 lines
819 B
TypeScript
Raw Normal View History

export const EVENT_ACTION = "action";
export const EVENT_ALIGN = "align";
2020-12-05 01:18:21 +02:00
export const EVENT_CHANGE = "change";
export const EVENT_DIALOG = "dialog";
2020-12-05 01:18:21 +02:00
export const EVENT_EXIT = "exit";
export const EVENT_IO = "io";
export const EVENT_LAYER = "layer";
2020-12-04 19:18:20 +02:00
export const EVENT_LIBRARY = "library";
2020-12-05 01:18:21 +02:00
export const EVENT_LOAD = "load";
export const EVENT_SHAPE = "shape";
export const EVENT_SHARE = "share";
export const EVENT_MAGIC = "magic";
export const trackEvent = window.gtag
? (category: string, name: string, label?: string, value?: number) => {
window.gtag("event", name, {
event_category: category,
event_label: label,
value,
});
}
: (category: string, name: string, label?: string, value?: number) => {
console.info("Track Event", category, name, label, value);
};