Skip to content

Commit aa6718b

Browse files
committed
Add google analytics to track whether anybody is using it
1 parent e9022b9 commit aa6718b

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222
run: npm run codegen;npm run build
2323
working-directory: web
2424

25+
- name: inject-analytics
26+
run: misc/apply.sh dist/index.html
27+
working-directory: web
28+
2529
- name: deploy (repo)
2630
uses: JamesIves/github-pages-deploy-action@4.1.4
2731
with:

web/misc/apply.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
sed -e 's/<\/head>/\nINSERT_ANALYTICS\n&/' $1 | sed -e '/INSERT_ANALYTICS/{r misc/ganalytics-tracking.html' -e 'd}' > /tmp/index.html
3+
mv /tmp/index.html $1

web/misc/ganalytics-tracking.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-YC9LH690WX"></script>
2+
<script>
3+
window.dataLayer = window.dataLayer || [];
4+
function gtag(){dataLayer.push(arguments);}
5+
gtag('js', new Date());
6+
7+
gtag('config', 'G-YC9LH690WX');
8+
</script>

0 commit comments

Comments
 (0)