Add basic event actions to analytics (#2375)

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Lipis 2020-12-02 23:57:51 +02:00 committed by GitHub
parent 014097a97e
commit abde1daba4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 183 additions and 61 deletions

16
src/analytics.ts Normal file
View file

@ -0,0 +1,16 @@
export const EVENT_ACTION = "action";
export const EVENT_EXIT = "exit";
export const EVENT_CHANGE = "change";
export const EVENT_SHAPE = "shape";
export const trackEvent = window.gtag
? (name: string, category: string, label?: string, value?: number) => {
window.gtag("event", name, {
event_category: category,
event_label: label,
value,
});
}
: (name: string, category: string, label?: string, value?: number) => {
console.info("Track Event", name, category, label, value);
};