Added umami analitycs support (#938)
* feat: added umami analityc support * chore: added support to on-premise deployment of umami service * chore: renamed 'proto' to 'scheme' on umami integration
This commit is contained in:
parent
a959cb174d
commit
f3dacf112c
3 changed files with 57 additions and 45 deletions
|
@ -38,6 +38,7 @@ A [Hugo](https://gohugo.io/) theme for a personal portfolio with minimalist desi
|
||||||
- counter.dev
|
- counter.dev
|
||||||
- Google Analytics
|
- Google Analytics
|
||||||
- Matomo/Piwik
|
- Matomo/Piwik
|
||||||
|
- [Umami](https://umami.is/)
|
||||||
- Comment Support
|
- Comment Support
|
||||||
- [Disqus](https://disqus.com/)
|
- [Disqus](https://disqus.com/)
|
||||||
- [Valine](https://valine.js.org/)
|
- [Valine](https://valine.js.org/)
|
||||||
|
|
|
@ -174,6 +174,11 @@ params:
|
||||||
# matomo:
|
# matomo:
|
||||||
# instance: matomo.example.com
|
# instance: matomo.example.com
|
||||||
# siteId: 1 # Or any other number
|
# siteId: 1 # Or any other number
|
||||||
|
# # Umami
|
||||||
|
# umami:
|
||||||
|
# scheme: https
|
||||||
|
# instance: umami.example.com
|
||||||
|
# id: <your umami site id>
|
||||||
|
|
||||||
# Enable Support
|
# Enable Support
|
||||||
support:
|
support:
|
||||||
|
|
|
@ -2,55 +2,61 @@
|
||||||
{{ with site.Params.features.analytics }}
|
{{ with site.Params.features.analytics }}
|
||||||
{{ if or .enable .enabled }}
|
{{ if or .enable .enabled }}
|
||||||
{{ with .services }}
|
{{ with .services }}
|
||||||
<!-- Google Analytics -->
|
<!-- Google Analytics -->
|
||||||
{{ with .google }}
|
{{ with .google }}
|
||||||
{{ $privacyConfig:= dict (slice "Site" "Config" "Privacy" "GoogleAnalytics") $.Site.Config.Privacy.GoogleAnalytics }}
|
{{ $privacyConfig:= dict (slice "Site" "Config" "Privacy" "GoogleAnalytics") $.Site.Config.Privacy.GoogleAnalytics }}
|
||||||
{{ $analyticsConfig := dict (slice "Site" "Config" "Services" "GoogleAnalytics" "ID") .id }}
|
{{ $analyticsConfig := dict (slice "Site" "Config" "Services" "GoogleAnalytics" "ID") .id }}
|
||||||
{{ template "_internal/google_analytics.html" (merge $privacyConfig $analyticsConfig) }}
|
{{ template "_internal/google_analytics.html" (merge $privacyConfig $analyticsConfig) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<!-- Counter.dev -->
|
<!-- Counter.dev -->
|
||||||
{{ with .counterDev }}
|
{{ with .counterDev }}
|
||||||
<script src="https://cdn.counter.dev/script.js"
|
<script src="https://cdn.counter.dev/script.js"
|
||||||
data-id="{{ .id }}"
|
data-id="{{ .id }}"
|
||||||
data-utcoffset="1"
|
data-utcoffset="1"
|
||||||
></script>
|
></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<!-- GoatCounter -->
|
<!-- GoatCounter -->
|
||||||
{{ with .goatCounter }}
|
{{ with .goatCounter }}
|
||||||
{{ with .code }}
|
{{ with .code }}
|
||||||
<script data-goatcounter="https://{{ . }}.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
|
<script data-goatcounter="https://{{ . }}.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<script data-goatcounter="https://{{ .instance }}/count" async src="https://{{ .instance }}/count.js"></script>
|
<script data-goatcounter="https://{{ .instance }}/count" async src="https://{{ .instance }}/count.js"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<!-- Piwik/Matomo -->
|
<!-- Piwik/Matomo -->
|
||||||
{{ with .matomo }}
|
{{ with .matomo }}
|
||||||
<!-- Matomo -->
|
<!-- Matomo -->
|
||||||
<script>
|
<script>
|
||||||
var _paq = window._paq = window._paq || [];
|
var _paq = window._paq = window._paq || [];
|
||||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||||
_paq.push(['trackPageView']);
|
_paq.push(['trackPageView']);
|
||||||
_paq.push(['enableLinkTracking']);
|
_paq.push(['enableLinkTracking']);
|
||||||
(function() {
|
(function() {
|
||||||
var u="//{{ .instance }}/";
|
var u="//{{ .instance }}/";
|
||||||
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||||||
_paq.push(['setSiteId', '{{ .siteId }}']);
|
_paq.push(['setSiteId', '{{ .siteId }}']);
|
||||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||||
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with .cloudflare }}
|
{{ with .cloudflare }}
|
||||||
<!-- Cloudflare Web Analytics -->
|
<!-- Cloudflare Web Analytics -->
|
||||||
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
|
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
|
||||||
data-cf-beacon='{"token": "{{ .token }}"}'
|
data-cf-beacon='{"token": "{{ .token }}"}'
|
||||||
></script>
|
></script>
|
||||||
<!-- End Cloudflare Web Analytics -->
|
<!-- End Cloudflare Web Analytics -->
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with .umami }}
|
||||||
|
<!-- Umami analytics -->
|
||||||
|
<script defer src='{{ or .scheme "https" }}://{{ or .instance "analytics.eu.umami.is" }}/script.js' data-website-id="{{ .id }}"></script>
|
||||||
|
<!-- End Umami analytics -->
|
||||||
|
{{end}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue