analytics.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <!-- Add Analytics if enabled in configuration -->
  2. {{ with site.Params.features.analytics }}
  3. {{ if or .enable .enabled }}
  4. {{ with .services }}
  5. <!-- Google Analytics -->
  6. {{ with .google }}
  7. {{ partial "google_analytics.html" . }}
  8. {{ end }}
  9. <!-- Counter.dev -->
  10. {{ with .counterDev }}
  11. <script src="https://cdn.counter.dev/script.js"
  12. data-id="{{ .id }}"
  13. data-utcoffset="1"
  14. ></script>
  15. {{ end }}
  16. <!-- GoatCounter -->
  17. {{ with .goatCounter }}
  18. {{ with .code }}
  19. <script data-goatcounter="https://{{ . }}.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
  20. {{ else }}
  21. <script data-goatcounter="https://{{ .instance }}/count" async src="https://{{ .instance }}/count.js"></script>
  22. {{ end }}
  23. {{ end }}
  24. <!-- Piwik/Matomo -->
  25. {{ with .matomo }}
  26. <!-- Matomo -->
  27. <script>
  28. var _paq = window._paq = window._paq || [];
  29. /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  30. _paq.push(['trackPageView']);
  31. _paq.push(['enableLinkTracking']);
  32. (function() {
  33. var u="//{{ .instance }}/";
  34. _paq.push(['setTrackerUrl', u+'matomo.php']);
  35. _paq.push(['setSiteId', '{{ .siteId }}']);
  36. var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
  37. g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  38. })();
  39. </script>
  40. {{ end }}
  41. {{ with .cloudflare }}
  42. <!-- Cloudflare Web Analytics -->
  43. <script defer src='https://static.cloudflareinsights.com/beacon.min.js'
  44. data-cf-beacon='{"token": "{{ .token }}"}'
  45. ></script>
  46. <!-- End Cloudflare Web Analytics -->
  47. {{ end }}
  48. {{ with .umami }}
  49. <!-- Umami analytics -->
  50. <script defer src='{{ or .scheme "https" }}://{{ or .instance "analytics.eu.umami.is" }}/script.js' data-website-id="{{ .id }}"></script>
  51. <!-- End Umami analytics -->
  52. {{end}}
  53. {{ with .statcounter }}
  54. <!-- Statcounter analytics -->
  55. <script type="text/javascript" src="https://www.statcounter.com/counter/counter.js" async></script>
  56. <script type="text/javascript">
  57. var sc_project = {{ .project }};
  58. var sc_invisible = {{ .invisible }};
  59. var sc_security = "{{ .security }}";
  60. var scJsHost = (("https:" == document.location.protocol) ?
  61. "https://www.statcounter.com/js/" : "https://www.statcounter.com/js/");
  62. </script>
  63. <noscript>
  64. <div class="statcounter"><a title="web counter" href="https://statcounter.com/" target="_blank"><img
  65. class="statcounter" src="https://c.statcounter.com/{{ .project }}/0/{{ .security }}/{{ .invisible }}/"
  66. alt="web counter" referrerPolicy="no-referrer-when-downgrade"></a></div>
  67. <!-- End of Statcounter Code -->
  68. </noscript>
  69. <!-- End Statcounter analytics -->
  70. {{ end }}
  71. {{ end }}
  72. {{ end }}
  73. {{ end }}
  74. <!-- Keep backwards compatibility and consistency with HUGO defaults -->
  75. {{ if .Site.Config.Services.GoogleAnalytics.ID }}
  76. {{ partial "google_analytics.html" . }}
  77. {{ end }}