diff options
author | Leonardo Faria <leonardofaria@gmail.com> | 2020-08-03 23:39:41 +0300 |
---|---|---|
committer | Leonardo Faria <leonardofaria@gmail.com> | 2020-08-03 23:39:41 +0300 |
commit | 069c0f5e8a43e5fec386e2ad82865a24504b75de (patch) | |
tree | 865d796e200199ee94603e487e3b81b14decb73d | |
parent | b16a5e74212b5f0c11a4503a88c0360fd72212a9 (diff) |
Add Turbolinks support in Fathom
-rw-r--r-- | layouts/partials/fathom.html | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/layouts/partials/fathom.html b/layouts/partials/fathom.html index a1a29e9..4536a34 100644 --- a/layouts/partials/fathom.html +++ b/layouts/partials/fathom.html @@ -10,4 +10,10 @@ })(document, window, '//{{ .Site.Params.fathomAnalytics.serverURL | default "cdn.usefathom.com" }}/tracker.js', 'fathom'); fathom('set', 'siteId', '{{ .Site.Params.fathomAnalytics.siteID }}'); fathom('trackPageview'); + + document.addEventListener('turbolinks:load', (e) => { + if (typeof window.fathom === 'function') { + window.fathom('trackPageview'); + } + }); </script> |