diff --git a/README.md b/README.md index ade37d51..c501c75a 100755 --- a/README.md +++ b/README.md @@ -78,6 +78,19 @@ If that's not enough, you can see [Overriding templates](#overriding-templates) * Keep your regular pages in the `content` folder. To create a new page, run `hugo new page-title.md` * Keep your blog posts in the `content/posts` folder. To create a new post, run `hugo new posts/post-title.md` +### Analytics + +While using Google Analytics is implemented in Hugo by default this template also can be used with [Fathom Analytics](https://usefathom.com/). + +In your `config.toml` you can specify your _siteID_ and, if you self-hosting, the tracker URL. + +```yaml +[params.fathomAnalytics] + siteID = "ABCDE" + # Default value is cdn.usefathom.com, overwrite this if you are self-hosting + # serverURL = "analytics.example.com" +``` + ### More customizations #### Overriding templates diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 4e60475c..9d138fd6 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -13,6 +13,11 @@ enableEmoji = true # Shorthand emojis in content files - https://gohugo.io/func # googleAnalytics = "UA-123-45" # disqusShortname = "yourdiscussshortname" +[params.fathomAnalytics] + # siteID = "ABCDE" + # Default value is cdn.usefathom.com, overwrite this if you are self-hosting + # serverURL = "analytics.example.com" + [author] name = "John Doe" diff --git a/layouts/partials/analytics.html b/layouts/partials/analytics.html index b1f9af88..1cfb56a8 100644 --- a/layouts/partials/analytics.html +++ b/layouts/partials/analytics.html @@ -1 +1,5 @@ {{ template "_internal/google_analytics_async.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 00000000..ea6eda3a --- /dev/null +++ b/layouts/partials/analytics/fathom.html @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/theme.toml b/theme.toml index 843956ca..8f17ae00 100644 --- a/theme.toml +++ b/theme.toml @@ -9,6 +9,7 @@ features = [ "featured image", "social icons", "google analytics", + "fathom analytics", "disqus" ] min_version = 0.43