Add Fathom analytics support

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2019-09-24 00:53:41 +05:30
parent f340dbd03c
commit c44010deff
2 changed files with 20 additions and 1 deletions

View File

@ -15,7 +15,8 @@ theme = "hello-friend-ng"
keywords = "homepage, blog, android, kotlin, programming"
contentTypeName = "posts"
defaultTheme = "dark"
customJS = ["https://stats.msfjarvis.website/kis3.js"]
FathomAnalyticsDomain = "stats.msfjarvis.website"
FathomAnalyticsSiteId = "BXNEC"
[menu]
[[menu.main]]

View File

@ -16,6 +16,24 @@
</script>
{{- end}}
{{- if .Site.Params.FathomAnalyticsDomain }}
<!-- 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, '//{{.Site.Params.FathomAnalyticsDomain}}/tracker.js', 'fathom');
fathom('set', 'siteId', '{{.Site.Params.FathomAnalyticsSiteId}}');
fathom('trackPageview');
</script>
<!-- / Fathom -->
{{- end }}
{{ range $val := $.Site.Params.customJS }}
{{ if gt (len $val) 0 }}
<script src="{{ $val }}"></script>