Skip to content

Commit f05cafc

Browse files
committed
add analytics
1 parent 8be01aa commit f05cafc

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

index.html

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
<link rel="stylesheet" href="/assets/reset.css" />
66
<link rel="stylesheet" href="/assets/open-props.1.4.min.css" />
77
<link rel="stylesheet" href="/styles.css" />
8+
<!-- Google tag (gtag.js) -->
9+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5YQYLX790M"></script>
10+
<script>
11+
window.dataLayer = window.dataLayer || [];
12+
function gtag(){dataLayer.push(arguments);}
13+
gtag('js', new Date());
14+
15+
gtag('config', 'G-5YQYLX790M');
16+
</script>
817
</head>
918

1019
<body>

src/common/types/declarations/global.d.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,12 @@ declare global {
3737
var THREE: typeof import("three");
3838
var postprocessing: typeof import("postprocessing");
3939
// ... other globals
40-
}
40+
}
41+
42+
declare interface Gtag {
43+
(command: 'config', targetId: string, config?: object): void;
44+
(command: 'set', config: object): void;
45+
(command: 'event', action: string, eventParams?: object): void;
46+
}
47+
48+
declare const gtag: Gtag;

src/core/titan-reactor.ts

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ globalEvents.on("queue-files", async ({ files: _files }) => {
8989
console.warn("no files to load")
9090
return;
9191
};
92+
93+
// google analytics - send file name only
94+
gtag("event", "queue-files", { "files" : files.map((f) => f.name).join(",") });
9295

9396
//todo map stuff here
9497
if (files[0].name.endsWith(".scx") || files[0].name.endsWith(".scm")) {

0 commit comments

Comments
 (0)