diff options
author | Erick Navarro <erick@navarro.io> | 2020-10-15 09:24:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-15 09:24:03 +0300 |
commit | de80afadd57bb3fb4bbd15ba9ea0f8680af17b71 (patch) | |
tree | 562ee56d2795ba90c5383dbd0f2b8aa16b6d0461 | |
parent | d59e88c2311fd99545314ecbe864bb2180ee0f57 (diff) |
Add plausible analytics support (#91)
Add the required script for analytics tracking using plausible
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | exampleSite/config.yml | 5 | ||||
-rw-r--r-- | layouts/partials/header.html | 1 | ||||
-rw-r--r-- | layouts/partials/plausible.html | 3 |
4 files changed, 13 insertions, 0 deletions
@@ -101,6 +101,10 @@ params: readingTimeText: "Estimated reading time:" fathomUrl: "" fathomSiteId: "" + plausibleAnalytics: + domain: "" + # Default value is plausible.io, overwrite this if you are self-hosting or using a custom domain + serverURL: "" permalinks: post: "/:year/:month/:day/:filename/" diff --git a/exampleSite/config.yml b/exampleSite/config.yml index 91e9489..daaa39d 100644 --- a/exampleSite/config.yml +++ b/exampleSite/config.yml @@ -61,6 +61,11 @@ params: readingTimeText: "Estimated reading time:" fathomUrl: "" fathomSiteId: "" + # If you want to use plausible(https://plausible.io) for analytics, add this section + plausibleAnalytics: + domain: "" + # Default value is plausible.io, overwrite this if you are self-hosting or using a custom domain + serverURL: "" permalinks: post: "/:year/:month/:day/:filename/" diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 4ebb753..1a60fb7 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -21,6 +21,7 @@ {{ partial "extra-in-head.html" . }} {{ partial "exponea.html" . }} {{ partial "fathom.html" . }} + {{ partial "plausible.html" . }} </head> <body> {{ template "_internal/google_analytics.html" . }} diff --git a/layouts/partials/plausible.html b/layouts/partials/plausible.html new file mode 100644 index 0000000..120a2f9 --- /dev/null +++ b/layouts/partials/plausible.html @@ -0,0 +1,3 @@ +{{ if and .Site.Params.plausibleAnalytics .Site.Params.plausibleAnalytics.domain }} + <script async defer data-domain="{{ .Site.Params.plausibleAnalytics.domain }}" src="https://{{ .Site.Params.plausibleAnalytics.serverURL | default "plausible.io" }}/js/plausible.js"></script> +{{ end }} |