diff --git a/config/_default/params.toml b/config/_default/params.toml index c79ad081..db391cb7 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -70,6 +70,11 @@ fingerprintAlgorithm = "sha256" # site = "ABC12345" # domain = "llama.yoursite.com" +[plausibleAnalytics] + # domain = "blog.yoursite.com" + # event = "" + # script = "" + [verification] # google = "" # bing = "" diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index e898deae..94b687a5 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -170,6 +170,9 @@ Many of the article defaults here can be overridden on a per article basis by sp |`taxonomy.showTermCount`|`true`|Whether or not the number of articles within a taxonomy term is displayed on the taxonomy listing.| |`fathomAnalytics.site`|_Not set_|The site code generated by Fathom Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.| |`fathomAnalytics.domain`|_Not set_|If using a custom domain with Fathom Analytics, provide it here to serve `script.js` from the custom domain.| +|`plausibleAnalytics.domain`|_Not set_|Enter the domain of the website you want to track. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.| +|`plausibleAnalytics.event`|_Not set_|Plausible api event proxied URL. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.| +|`plausibleAnalytics.script`|_Not set_|Plausible analysis script proxied URL. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.| |`verification.google`|_Not set_|The site verification string provided by Google to be included in the site metadata.| |`verification.bing`|_Not set_|The site verification string provided by Bing to be included in the site metadata.| |`verification.pinterest`|_Not set_|The site verification string provided by Pinterest to be included in the site metadata.| diff --git a/exampleSite/content/docs/partials/index.md b/exampleSite/content/docs/partials/index.md index abb44d5a..17f2987f 100644 --- a/exampleSite/content/docs/partials/index.md +++ b/exampleSite/content/docs/partials/index.md @@ -24,6 +24,19 @@ To enable Fathom Analytics support, simply provide your Fathom site code in the domain = "llama.yoursite.com" ``` +### Plausible Analytics + +To enable Plausible analytics support, simply provide the domain of the website you want to track in the `config/_default/params.toml` file. If you are using a self-hosted Plausible, or wish to use a [proxied analytics](https://plausible.io/docs/proxy/introduction) script and event API router, you can also provide additional `event` and `script` configuration values. If you do not provide these two values, the script will load directly with Plausible's default managed service. Refer to [Using a proxy for analytics](https://plausible.io/docs/proxy/introduction) for more details. + +```toml +# config/_default/params.toml + +[plausibleAnalytics] + domain = "blog.yoursite.com" + event = "https://plausible.yoursite.com/api/event" + script = "https://plausible.yoursite.com/js/script.js" +``` + ### Google Analytics Google Analytics support is provided through the internal Hugo partial. Simply provide the `googleAnalytics` key in the `config/_default/config.toml` file and the script will be added automatically. diff --git a/layouts/partials/analytics.html b/layouts/partials/analytics.html index f8c7c2c2..64a2e350 100644 --- a/layouts/partials/analytics.html +++ b/layouts/partials/analytics.html @@ -6,5 +6,11 @@ {{ end }} {{ end }} + {{ with site.Params.plausibleAnalytics.domain }} + + {{ end }} {{ template "_internal/google_analytics.html" . }} -{{ end }} +{{ end }} \ No newline at end of file