From a5d0b9a3ebc09467c67ea0964e2c41052787dc8b Mon Sep 17 00:00:00 2001 From: codedge Date: Tue, 21 Apr 2020 17:37:05 +0200 Subject: [PATCH] Add fathom analytics (#200) Co-authored-by: Dillon --- README.md | 1 + exampleSite/config.toml | 5 +++++ layouts/partials/assets.html | 6 +++++- layouts/partials/plugin/analytics/fathom.html | 13 +++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/plugin/analytics/fathom.html diff --git a/README.md b/README.md index 6d9b8c4..fc14b3a 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ I hope you will LoveIt ❤️! * Optimized for **performance**: 99/100 on mobile and 100/100 on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights) * Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD * [**Google Analytics**](https://analytics.google.com/analytics) supported +* [**Fathom Analytics**](https://usefathom.com/) supported * Search engine **verification** supported (Google, Bind, Yandex and Baidu) * **CDN** for third-party libraries supported * Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index f5163d6..6fd3bdc 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -782,6 +782,11 @@ enableEmoji = true yandex = "" pinterest = "" baidu = "" + [params.fathomAnalytics] + # siteID = "ABC123" + # If you're self hosting use this for your tracker + # serverURL = "https://example.com" + # CSS and JS Files CDN # CSS 和 JS 文件的 CDN 设置 [params.cdn] diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html index be676a9..d8952a0 100644 --- a/layouts/partials/assets.html +++ b/layouts/partials/assets.html @@ -264,4 +264,8 @@ {{- /* Google analytics async */ -}} {{- if eq hugo.Environment "production" | and .Site.GoogleAnalytics -}} {{- template "_internal/google_analytics_async.html" . -}} -{{- end -}} + + {{ if and .Site.Params.fathomAnalytics .Site.Params.fathomAnalytics.siteID }} + {{- partial "plugin/analytics/fathom" . -}} + {{ end }} +{{- end -}} \ No newline at end of file diff --git a/layouts/partials/plugin/analytics/fathom.html b/layouts/partials/plugin/analytics/fathom.html new file mode 100644 index 0000000..89210b9 --- /dev/null +++ b/layouts/partials/plugin/analytics/fathom.html @@ -0,0 +1,13 @@ + \ No newline at end of file