Add analytics

This commit is contained in:
Cory LaViska
2020-07-15 08:02:32 -04:00
parent 02747fb362
commit 30bed73346
2 changed files with 14 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ app.use(
app.use(/^\/$/, async (req, res, next) => {
let index = await fs.readFile('./docs/index.html', 'utf8');
index = index
.replace('</head>', '<script>window.ShoelaceDevServer = true;</script></head>')
.replace('<head>', '<head><script>window.ShoelaceDevServer = true;</script>')
.replace(
'</body>',
'<iframe src="/~dev-server" style="display: block; width: 0; height: 0; border: 0;"></iframe></body>'

View File

@@ -18,6 +18,19 @@
<!-- Import Shoelace -->
<link rel="stylesheet" href="/dist/shoelace/shoelace.css" />
<script type="module" src="/dist/shoelace/shoelace.esm.js"></script>
<!-- Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-6412891-16"></script>
<script>
if (!window.ShoelaceDevServer) {
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-6412891-16');
}
</script>
</head>
<body>
<div id="app"></div>