mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-22 14:35:43 -06:00
support seline analytics
This commit is contained in:
parent
18ed67b2e6
commit
bcc26c11b8
4 changed files with 29 additions and 0 deletions
|
@ -136,6 +136,10 @@ disableTextInHeader = false
|
|||
# domain = "llama.yoursite.com"
|
||||
# dataDomains = "yoursite.com,yoursite2.com"
|
||||
|
||||
[selineAnalytics]
|
||||
# token = "XXXXXX"
|
||||
# enableTrace = false
|
||||
|
||||
[buymeacoffee]
|
||||
# identifier = ""
|
||||
# globalWidget = true
|
||||
|
|
|
@ -135,6 +135,10 @@ smartTOCHideUnfocusedChildren = false
|
|||
# domain = "llama.yoursite.com"
|
||||
# dataDomains = "yoursite.com,yoursite2.com"
|
||||
|
||||
[selineAnalytics]
|
||||
# token = "XXXXXX"
|
||||
# enableTrace = false
|
||||
|
||||
[buymeacoffee]
|
||||
identifier = "nunocoracao"
|
||||
globalWidget = true
|
||||
|
|
|
@ -6,4 +6,7 @@
|
|||
{{ end }}
|
||||
{{ with site.Params.umamiAnalytics.websiteid }}
|
||||
{{ partial "analytics/umami.html" }}
|
||||
{{ end }}
|
||||
{{ with site.Params.selineAnalytics.token }}
|
||||
{{ partial "analytics/seline.html" }}
|
||||
{{ end }}
|
18
layouts/partials/analytics/seline.html
Normal file
18
layouts/partials/analytics/seline.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<script async src="https://cdn.seline.so/seline.js" data-token="{{ site.Params.selineAnalytics.token }}" data-id="seline-script"></script>
|
||||
|
||||
{{ if .Site.Params.selineAnalytics.enableTrace | default false }}
|
||||
<script type="text/javascript">
|
||||
document.querySelector('script[data-id="seline-script"]')
|
||||
.addEventListener('load', function () {
|
||||
const type = document.head.querySelector('meta[property = "og:type"]').getAttribute('content');
|
||||
let title = document.head.querySelector('meta[property = "og:title"]').getAttribute('content');
|
||||
let url = document.head.querySelector('meta[property = "og:url"]').getAttribute('content');
|
||||
|
||||
seline.track("user:" + type + ':' + title, {
|
||||
type: type,
|
||||
title: title,
|
||||
url: url
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
Loading…
Reference in a new issue