-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Carson Yang <[email protected]>
- Loading branch information
1 parent
1e48922
commit 1db8161
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{ if isset site.Params.umamiAnalytics "domain" }} | ||
<script data-id="umami-script" async src="https://{{ site.Params.umamiAnalytics.domain }}/{{ site.Params.umamiAnalytics.scriptName }}" data-website-id="{{ site.Params.umamiAnalytics.websiteid }}"> | ||
</script> | ||
{{ else }} | ||
<script data-id="umami-script" async src="https://analytics.umami.is/script.js" data-website-id="{{ site.Params.umamiAnalytics.websiteid }}"> | ||
</script> | ||
{{ end }} | ||
|
||
<script type="text/javascript"> | ||
document.querySelector('script[data-id="umami-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'); | ||
umami.track(type + ':' + title, {'url': url}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,11 @@ | |
{{- end -}} | ||
{{- end -}} | ||
<!-- change --> | ||
{{- if not .Site.IsServer }} | ||
{{ with site.Params.umamiAnalytics.websiteid }} | ||
{{- partialCached (printf "%s/%s" ($.Scratch.Get "pathName") "analytics/umami.html") . -}} | ||
{{ end }} | ||
{{ end }} | ||
<link rel="preload" href="https://cdn.jsdelivr.net/npm/[email protected]/style.css" as="style" /> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/style.css" /> | ||
</head> |