From f05cafcf30b659c245e0e787e42f1ac69f52258c Mon Sep 17 00:00:00 2001 From: DM Date: Fri, 24 Nov 2023 11:28:01 -0500 Subject: [PATCH] add analytics --- index.html | 9 +++++++++ src/common/types/declarations/global.d.ts | 10 +++++++++- src/core/titan-reactor.ts | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 4c94b759..b11ce5b2 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,15 @@ + + + diff --git a/src/common/types/declarations/global.d.ts b/src/common/types/declarations/global.d.ts index e4618e0a..a55201e3 100644 --- a/src/common/types/declarations/global.d.ts +++ b/src/common/types/declarations/global.d.ts @@ -37,4 +37,12 @@ declare global { var THREE: typeof import("three"); var postprocessing: typeof import("postprocessing"); // ... other globals -} \ No newline at end of file +} + +declare interface Gtag { + (command: 'config', targetId: string, config?: object): void; + (command: 'set', config: object): void; + (command: 'event', action: string, eventParams?: object): void; +} + +declare const gtag: Gtag; \ No newline at end of file diff --git a/src/core/titan-reactor.ts b/src/core/titan-reactor.ts index 04cbdfe8..aa9c2221 100644 --- a/src/core/titan-reactor.ts +++ b/src/core/titan-reactor.ts @@ -89,6 +89,9 @@ globalEvents.on("queue-files", async ({ files: _files }) => { console.warn("no files to load") return; }; + + // google analytics - send file name only + gtag("event", "queue-files", { "files" : files.map((f) => f.name).join(",") }); //todo map stuff here if (files[0].name.endsWith(".scx") || files[0].name.endsWith(".scm")) {