refactor: plausible support

pull/584/head
Dejavu Moe 2023-06-25 15:51:45 +08:00
parent 2deaecf5b7
commit 35ead410c7
No known key found for this signature in database
GPG Key ID: 8422222222222222
4 changed files with 12 additions and 18 deletions

View File

@ -71,10 +71,9 @@ fingerprintAlgorithm = "sha256"
# domain = "llama.yoursite.com"
[plausible]
enable = false
domain = "blog.yoursite.com"
event = ""
script = ""
# domain = "blog.yoursite.com"
# event = ""
# script = ""
[verification]
# google = ""

View File

@ -170,10 +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.|
|`plausible.enable`|`false`|Whether to enable Plausible analytics, set `true` to enable.|
|`plausible.domain`|_Not set_|Enter the domain name of the website you want to track. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.|
|`plausible.event`|_Not set_|Plausible api event proxy URL. Refer to [Using a proxy for analytics](https://plausible.io/docs/proxy/introduction) for more details.|
|`plausible.script`|_Not set_|Plausible analysis script proxy URL. Refer to [Using a proxy for analytics](https://plausible.io/docs/proxy/introduction) for more details.|
|`plausible.domain`|_Not set_|Enter the domain of the website you want to track. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.|
|`plausible.event`|_Not set_|Plausible api event proxied URL. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details.|
|`plausible.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.|

View File

@ -26,16 +26,15 @@ To enable Fathom Analytics support, simply provide your Fathom site code in the
### Plausible Analytics
To enable Plausible analytics support, simply set `plausible.enable` to `true` in the `config/_default/params.toml` file, and then provide your Plausible site `domain`. If you are using a self-hosted Plausible, or wish to use [proxied analytics](https://plausible.io/docs/proxy/introduction) scripts 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.
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
[plausible]
enable = true
domain = "blog.yoursite.com"
# event = ""
# script = ""
event = "https://plausible.yoursite.com/api/event"
script = "https://plausible.yoursite.com/js/script.js"
```
### Google Analytics

View File

@ -6,14 +6,11 @@
<script defer src="https://cdn.usefathom.com/script.js" data-site="{{ . }}"></script>
{{ end }}
{{ end }}
{{ if site.Params.plausible.enable }}
{{ with site.Params.plausible.domain }}
<script
defer
{{ with site.Params.plausible.domain }}
<script defer
data-domain="{{ . }}"
data-api="{{ default "https://plausible.io/api/event" site.Params.plausible.event }}"
src="{{ default "https://plausible.io/js/script.js" site.Params.plausible.script }}"></script>
{{ end }}
{{ end }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}