From 93fb14e953a1c0275635093f6d22268236b3f216 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Tue, 11 Feb 2020 19:58:14 +0530 Subject: [PATCH] Add support for Fathom Analytics (#264) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for Fathom Analytics * Add myself to CONTRIBUTORS.md * Set default for serverURL and check for siteID * Update layouts/_default/baseof.html Co-Authored-By: Luiz F. A. de Prá Co-authored-by: Luiz F. A. de Prá --- CONTRIBUTORS.md | 1 + exampleSite/config.toml | 6 ++++++ layouts/_default/baseof.html | 4 ++++ layouts/partials/analytics/fathom.html | 13 +++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 layouts/partials/analytics/fathom.html diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fbfcd3e..8873dc6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -56,3 +56,4 @@ - [Anson VanDoren](https://github.com/anson-vandoren) - [Michael Lynch](https://github.com/mtlynch) - [FIGBERT](https://figbert.com/) +- [Yash Mehrotra](https://yashmehrotra.com) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 2a38e9b..61ed225 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -50,6 +50,12 @@ disqusShortname = "yourdiscussshortname" # Custom JS custom_js = [] +# If you want to use fathom(https://usefathom.com) for analytics, add this section +[params.fathomAnalytics] + siteID = "ABCDE" + # Default value is cdn.usefathom.com, overwrite this if you are self-hosting + serverURL = "analytics.example.com" + [taxonomies] category = "categories" series = "series" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 3824e2e..a497e5d 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -108,6 +108,10 @@ {{ template "_internal/google_analytics.html" . }} + {{ if and .Site.Params.fathomAnalytics .Site.Params.fathomAnalytics.siteID }} + {{- partial "analytics/fathom" . -}} + {{ end }} + diff --git a/layouts/partials/analytics/fathom.html b/layouts/partials/analytics/fathom.html new file mode 100644 index 0000000..13e7cfc --- /dev/null +++ b/layouts/partials/analytics/fathom.html @@ -0,0 +1,13 @@ +