mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-23 06:55:43 -06:00
fix umami
This commit is contained in:
parent
a0d05ce208
commit
5ad54fd91a
1 changed files with 6 additions and 13 deletions
|
@ -1,23 +1,16 @@
|
||||||
{{ if isset site.Params.umamiAnalytics "domain" }}
|
{{ if isset site.Params.umamiAnalytics "domain" }}
|
||||||
<script 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 }}">
|
||||||
</script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
document.querySelector('#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>
|
</script>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<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 }}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.querySelector('#umami-script').addEventListener('load', function () {
|
document.querySelector('script[data-id="umami-script"]').addEventListener('load', function () {
|
||||||
const type = document.head.querySelector('meta[property = "og:type"]').getAttribute('content');
|
const type = document.head.querySelector('meta[property = "og:type"]').getAttribute('content');
|
||||||
let title = document.head.querySelector('meta[property = "og:title"]').getAttribute('content');
|
let title = document.head.querySelector('meta[property = "og:title"]').getAttribute('content');
|
||||||
let url = document.head.querySelector('meta[property = "og:url"]').getAttribute('content');
|
let url = document.head.querySelector('meta[property = "og:url"]').getAttribute('content');
|
||||||
umami.track(type + ':' +title, {'url': url});
|
umami.track(type + ':' +title, {'url': url});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
|
Loading…
Reference in a new issue