mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-22 22:45:42 -06:00
umami analytics support data-domains
This commit is contained in:
parent
c6c2689195
commit
6f73fc630c
11 changed files with 42 additions and 24 deletions
|
@ -134,6 +134,7 @@ disableTextInHeader = false
|
||||||
[umamiAnalytics]
|
[umamiAnalytics]
|
||||||
# websiteid = "ABC12345"
|
# websiteid = "ABC12345"
|
||||||
# domain = "llama.yoursite.com"
|
# domain = "llama.yoursite.com"
|
||||||
|
# dataDomains = "yoursite.com,yoursite2.com"
|
||||||
|
|
||||||
[buymeacoffee]
|
[buymeacoffee]
|
||||||
# identifier = ""
|
# identifier = ""
|
||||||
|
|
|
@ -133,6 +133,7 @@ smartTOCHideUnfocusedChildren = false
|
||||||
[umamiAnalytics]
|
[umamiAnalytics]
|
||||||
# websiteid = "ABC12345"
|
# websiteid = "ABC12345"
|
||||||
# domain = "llama.yoursite.com"
|
# domain = "llama.yoursite.com"
|
||||||
|
# dataDomains = "yoursite.com,yoursite2.com"
|
||||||
|
|
||||||
[buymeacoffee]
|
[buymeacoffee]
|
||||||
identifier = "nunocoracao"
|
identifier = "nunocoracao"
|
||||||
|
|
|
@ -318,10 +318,11 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
||||||
|
|
||||||
### Umami Analytics
|
### Umami Analytics
|
||||||
|
|
||||||
| Name | Default | Description |
|
| Name | Default | Description |
|
||||||
| -------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
| -------------------------- | --------- |----------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `umamiAnalytics.websiteid` | _Not set_ | The site code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. |
|
| `umamiAnalytics.websiteid` | _Not set_ | The site code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. |
|
||||||
| `umamiAnalytics.domain` | _Not set_ | If using a custom domain with Umami Analytics, provide it here to serve `script.js` from the custom domain. |
|
| `umamiAnalytics.domain` | _Not set_ | If using a custom domain with Umami Analytics, provide it here to serve `script.js` from the custom domain. |
|
||||||
|
| `umamiAnalytics.dataDomains` | _Not set_ | If you want the tracker to only run on specific domains, provide it for your tracker script. This is a comma delimited list of domain names. Such as "yoursite.com,yoursite2.com". |
|
||||||
|
|
||||||
### BuyMeACoffee
|
### BuyMeACoffee
|
||||||
|
|
||||||
|
|
|
@ -317,10 +317,11 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
||||||
|
|
||||||
### Umami Analytics
|
### Umami Analytics
|
||||||
|
|
||||||
| Name | Default | Description |
|
| Name | Default | Description |
|
||||||
| -------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
| -------------------------- | --------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `umamiAnalytics.websiteid` | _Not set_ | The site code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. |
|
| `umamiAnalytics.websiteid` | _Not set_ | The site code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. |
|
||||||
| `umamiAnalytics.domain` | _Not set_ | If using a custom domain with Umami Analytics, provide it here to serve `script.js` from the custom domain. |
|
| `umamiAnalytics.domain` | _Not set_ | If using a custom domain with Umami Analytics, provide it here to serve `script.js` from the custom domain. |
|
||||||
|
| `umamiAnalytics.dataDomains` | _Not set_ | If you want the tracker to only run on specific domains, provide it for your tracker script. This is a comma delimited list of domain names. Such as "yoursite.com,yoursite2.com". |
|
||||||
|
|
||||||
### BuyMeACoffee
|
### BuyMeACoffee
|
||||||
|
|
||||||
|
|
|
@ -318,10 +318,11 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
||||||
|
|
||||||
### Umami Analytics
|
### Umami Analytics
|
||||||
|
|
||||||
| Name | Default | Description |
|
| Name | Default | Description |
|
||||||
| -------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
| -------------------------- | --------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `umamiAnalytics.websiteid` | _Not set_ | The site code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. |
|
| `umamiAnalytics.websiteid` | _Not set_ | The site code generated by Umami Analytics for the website. Refer to the [Analytics docs]({{< ref "partials#analytics" >}}) for more details. |
|
||||||
| `umamiAnalytics.domain` | _Not set_ | If using a custom domain with Umami Analytics, provide it here to serve `script.js` from the custom domain. |
|
| `umamiAnalytics.domain` | _Not set_ | If using a custom domain with Umami Analytics, provide it here to serve `script.js` from the custom domain. |
|
||||||
|
| `umamiAnalytics.dataDomains` | _Not set_ | If you want the tracker to only run on specific domains, provide it for your tracker script. This is a comma delimited list of domain names. Such as "yoursite.com,yoursite2.com". |
|
||||||
|
|
||||||
|
|
||||||
### BuyMeACoffee
|
### BuyMeACoffee
|
||||||
|
|
|
@ -321,10 +321,11 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中
|
||||||
|
|
||||||
### Umami Analytics
|
### Umami Analytics
|
||||||
|
|
||||||
| Name | Default | Description |
|
| Name | Default | Description |
|
||||||
| -------------------------- | --------- | ------------------------------------------------------------------------------------------ |
|
| -------------------------- | --------- |-------------------------------------------------------------------------------------|
|
||||||
| `umamiAnalytics.websiteid` | _Not set_ | 支持 Umami 站点分析平台。更多详细内容请参考 [分析文档]({{< ref "partials#analytics" >}})。 |
|
| `umamiAnalytics.websiteid` | _Not set_ | 支持 Umami 站点分析平台。更多详细内容请参考 [分析文档]({{< ref "partials#analytics" >}})。 |
|
||||||
| `umamiAnalytics.domain` | _Not set_ | 如果使用自定义域名的 Umami Analytics,请在此提供,以便从自定义域名获取 `script.js`。 |
|
| `umamiAnalytics.domain` | _Not set_ | 如果使用自定义域名的 Umami Analytics,请在此提供,以便从自定义域名获取 `script.js`。 |
|
||||||
|
| `umamiAnalytics.dataDomains` | _Not set_ | 如果你只想在特别的数个域名中使用 tracker 功能,那么你需要设置它。这个参数的值是逗号分隔的域名列表,如:yoursite.com,yoursite2.com。 |
|
||||||
|
|
||||||
|
|
||||||
### BuyMeACoffee
|
### BuyMeACoffee
|
||||||
|
|
|
@ -44,6 +44,7 @@ googleAnalytics = "G-MEASUREMENT_ID"
|
||||||
|
|
||||||
To enable Umami Analytics support, simply provide your [Umami tracking code](https://umami.is/docs/collect-data) in the `config/_default/params.toml` file.
|
To enable Umami Analytics support, simply provide your [Umami tracking code](https://umami.is/docs/collect-data) in the `config/_default/params.toml` file.
|
||||||
If you also use the custom domain feature of Umami and would like to serve their script from your domain, you can also additionally provide the `domain` configuration value. If you don't provide a `domain` value, the script will load directly from Umami DNS (analytics.umami.is).
|
If you also use the custom domain feature of Umami and would like to serve their script from your domain, you can also additionally provide the `domain` configuration value. If you don't provide a `domain` value, the script will load directly from Umami DNS (analytics.umami.is).
|
||||||
|
If you want the tracker to only run on specific domains, you can provide the `dataDomains` configuration value. If you don't provide a `dataDomains` value, the script will run on any website where the `domain` and` websiteid` match.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# config/_default/params.toml
|
# config/_default/params.toml
|
||||||
|
@ -51,6 +52,7 @@ If you also use the custom domain feature of Umami and would like to serve their
|
||||||
[umamiAnalytics]
|
[umamiAnalytics]
|
||||||
websiteid = "ABC12345"
|
websiteid = "ABC12345"
|
||||||
domain = "llama.yoursite.com"
|
domain = "llama.yoursite.com"
|
||||||
|
dataDomains = "yoursite.com,yoursite2.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Custom analytics providers
|
### Custom analytics providers
|
||||||
|
|
|
@ -44,6 +44,7 @@ googleAnalytics = "G-MEASUREMENT_ID"
|
||||||
|
|
||||||
To enable Umami Analytics support, simply provide your [Umami tracking code](https://umami.is/docs/collect-data) in the `config/_default/params.toml` file.
|
To enable Umami Analytics support, simply provide your [Umami tracking code](https://umami.is/docs/collect-data) in the `config/_default/params.toml` file.
|
||||||
If you also use the custom domain feature of Umami and would like to serve their script from your domain, you can also additionally provide the `domain` configuration value. If you don't provide a `domain` value, the script will load directly from Umami DNS (analytics.umami.is).
|
If you also use the custom domain feature of Umami and would like to serve their script from your domain, you can also additionally provide the `domain` configuration value. If you don't provide a `domain` value, the script will load directly from Umami DNS (analytics.umami.is).
|
||||||
|
If you want the tracker to only run on specific domains, you can provide the `dataDomains` configuration value. If you don't provide a `dataDomains` value, the script will run on any website where the `domain` and` websiteid` match.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# config/_default/params.toml
|
# config/_default/params.toml
|
||||||
|
@ -51,6 +52,7 @@ If you also use the custom domain feature of Umami and would like to serve their
|
||||||
[umamiAnalytics]
|
[umamiAnalytics]
|
||||||
websiteid = "ABC12345"
|
websiteid = "ABC12345"
|
||||||
domain = "llama.yoursite.com"
|
domain = "llama.yoursite.com"
|
||||||
|
dataDomains = "yoursite.com,yoursite2.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Custom analytics providers
|
### Custom analytics providers
|
||||||
|
|
|
@ -44,13 +44,14 @@ googleAnalytics = "G-MEASUREMENT_ID"
|
||||||
|
|
||||||
To enable Umami Analytics support, simply provide your [Umami tracking code](https://umami.is/docs/collect-data) in the `config/_default/params.toml` file.
|
To enable Umami Analytics support, simply provide your [Umami tracking code](https://umami.is/docs/collect-data) in the `config/_default/params.toml` file.
|
||||||
If you also use the custom domain feature of Umami and would like to serve their script from your domain, you can also additionally provide the `domain` configuration value. If you don't provide a `domain` value, the script will load directly from Umami DNS (analytics.umami.is).
|
If you also use the custom domain feature of Umami and would like to serve their script from your domain, you can also additionally provide the `domain` configuration value. If you don't provide a `domain` value, the script will load directly from Umami DNS (analytics.umami.is).
|
||||||
|
If you want the tracker to only run on specific domains, you can provide the `dataDomains` configuration value. If you don't provide a `dataDomains` value, the script will run on any website where the `domain` and` websiteid` match.
|
||||||
```toml
|
```toml
|
||||||
# config/_default/params.toml
|
# config/_default/params.toml
|
||||||
|
|
||||||
[umamiAnalytics]
|
[umamiAnalytics]
|
||||||
websiteid = "ABC12345"
|
websiteid = "ABC12345"
|
||||||
domain = "llama.yoursite.com"
|
domain = "llama.yoursite.com"
|
||||||
|
dataDomains = "yoursite.com,yoursite2.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Custom analytics providers
|
### Custom analytics providers
|
||||||
|
|
|
@ -48,6 +48,7 @@ googleAnalytics = "G-MEASUREMENT_ID"
|
||||||
|
|
||||||
只需要在 `config/_default/params.toml` 文件提供你的 [Umami 跟踪代码](https://umami.is/docs/collect-data),就可以快速支持 Umami 站点分析。
|
只需要在 `config/_default/params.toml` 文件提供你的 [Umami 跟踪代码](https://umami.is/docs/collect-data),就可以快速支持 Umami 站点分析。
|
||||||
如果你想使用自定义域名来获取跟踪脚本, 那么需要提供 `domain` 参数,否则会从 Umami 云服务版的地址 (analytics.umami.is) 获取脚本。
|
如果你想使用自定义域名来获取跟踪脚本, 那么需要提供 `domain` 参数,否则会从 Umami 云服务版的地址 (analytics.umami.is) 获取脚本。
|
||||||
|
如果你只想在特别的数个域名中使用 tracker 功能,那么需要提供 `dataDomains` 参数。否则任何一个匹配了 `websiteid` 和 `domain` 参数值的网站,Umami 脚本都会执行。
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# config/_default/params.toml
|
# config/_default/params.toml
|
||||||
|
@ -55,6 +56,7 @@ googleAnalytics = "G-MEASUREMENT_ID"
|
||||||
[umamiAnalytics]
|
[umamiAnalytics]
|
||||||
websiteid = "ABC12345"
|
websiteid = "ABC12345"
|
||||||
domain = "llama.yoursite.com"
|
domain = "llama.yoursite.com"
|
||||||
|
dataDomains = "yoursite.com,yoursite2.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
### 提供自定义站点分析
|
### 提供自定义站点分析
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
{{ if isset site.Params.umamiAnalytics "domain" }}
|
{{ if isset site.Params.umamiAnalytics "domain" }}
|
||||||
<script data-id="umami-script" async src="https://{{ site.Params.umamiAnalytics.domain }}/script.js" data-website-id="{{ site.Params.umamiAnalytics.websiteid }}">
|
<script data-id="umami-script" async
|
||||||
|
src="https://{{ site.Params.umamiAnalytics.domain }}/script.js"
|
||||||
|
data-website-id="{{ site.Params.umamiAnalytics.websiteid }}"
|
||||||
|
{{ with site.Params.umamiAnalytics.dataDomains }}data-domains="{{ . }}"{{ end }}>
|
||||||
</script>
|
</script>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<script data-id="umami-script" async src="https://analytics.umami.is/script.js" data-website-id="{{ site.Params.umamiAnalytics.websiteid }}">
|
<script data-id="umami-script" async src="https://analytics.umami.is/script.js"
|
||||||
|
data-website-id="{{ site.Params.umamiAnalytics.websiteid }}">
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.querySelector('script[data-id="umami-script"]').addEventListener('load', function () {
|
document.querySelector('script[data-id="umami-script"]')
|
||||||
const type = document.head.querySelector('meta[property = "og:type"]').getAttribute('content');
|
.addEventListener('load', function () {
|
||||||
let title = document.head.querySelector('meta[property = "og:title"]').getAttribute('content');
|
const type = document.head.querySelector('meta[property = "og:type"]').getAttribute('content');
|
||||||
let url = document.head.querySelector('meta[property = "og:url"]').getAttribute('content');
|
let title = document.head.querySelector('meta[property = "og:title"]').getAttribute('content');
|
||||||
umami.track(type + ':' + title, {'url': url});
|
let url = document.head.querySelector('meta[property = "og:url"]').getAttribute('content');
|
||||||
|
umami.track(type + ':' + title, {'url': url});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
Loading…
Reference in a new issue