Skip to content

Commit

Permalink
Merge pull request #266 from alexpineda/dev
Browse files Browse the repository at this point in the history
add analytics
  • Loading branch information
alexpineda committed Nov 24, 2023
2 parents ba982bb + f05cafc commit 92791d4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
<link rel="stylesheet" href="/assets/reset.css" />
<link rel="stylesheet" href="/assets/open-props.1.4.min.css" />
<link rel="stylesheet" href="/styles.css" />
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5YQYLX790M"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-5YQYLX790M');
</script>
</head>

<body>
Expand Down
10 changes: 9 additions & 1 deletion src/common/types/declarations/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@ declare global {
var THREE: typeof import("three");
var postprocessing: typeof import("postprocessing");
// ... other globals
}
}

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;
3 changes: 3 additions & 0 deletions src/core/titan-reactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down

0 comments on commit 92791d4

Please sign in to comment.