1
0
mirror of https://github.com/danbee/danbarber.me.hugo.git synced 2025-03-04 08:59:18 +00:00

Add analytics

This commit is contained in:
Daniel Barber 2019-10-27 18:46:50 -04:00
parent 96c794b8ee
commit 22b1e24d54
2 changed files with 18 additions and 0 deletions

View File

@ -10,5 +10,7 @@
{{ end }}
</main>
{{ partial "footer.html" . }}
{{ partial "analytics.html" . }}
</body>
</html>

View File

@ -0,0 +1,16 @@
{{ if eq (getenv "CONTEXT") "production" }}
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, 'https://stats.danbarber.me/tracker.js', 'fathom');
fathom('trackPageview');
</script>
<!-- / Fathom -->
{{ end }}