12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <!-- Add Analytics if enabled in configuration -->
- {{ with site.Params.features.analytics }}
- {{ if or .enable .enabled }}
- {{ with .services }}
- <!-- Google Analytics -->
- {{ with .google }}
- {{ $privacyConfig:= dict (slice "Site" "Config" "Privacy" "GoogleAnalytics") $.Site.Config.Privacy.GoogleAnalytics }}
- {{ $analyticsConfig := dict (slice "Site" "GoogleAnalytics") .id }}
- {{ template "_internal/google_analytics.html" (merge $privacyConfig $analyticsConfig) }}
- {{ end }}
- <!-- Counter.dev -->
- {{ with .counterDev }}
- <script src="https://cdn.counter.dev/script.js"
- data-id="{{ .id }}"
- data-utcoffset="1"
- ></script>
- {{ end }}
- <!-- GoatCounter -->
- {{ with .goatCounter }}
- {{ with .code }}
- <script data-goatcounter="https://{{ . }}.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
- {{ else }}
- <script data-goatcounter="https://{{ .instance }}/count" async src="https://{{ .instance }}/count.js"></script>
- {{ end }}
- {{ end }}
- <!-- Piwik/Matomo -->
- {{ with .matomo }}
- <!-- Matomo -->
- <script>
- var _paq = window._paq = window._paq || [];
- /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
- _paq.push(['trackPageView']);
- _paq.push(['enableLinkTracking']);
- (function() {
- var u="//{{ .instance }}/";
- _paq.push(['setTrackerUrl', u+'matomo.php']);
- _paq.push(['setSiteId', '{{ .siteId }}']);
- 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);
- })();
- </script>
- {{ end }}
- {{ with .cloudflare }}
- <!-- Cloudflare Web Analytics -->
- <script defer src='https://static.cloudflareinsights.com/beacon.min.js'
- data-cf-beacon='{"token": "{{ .token }}"}'
- ></script>
- <!-- End Cloudflare Web Analytics -->
- {{ end }}
- {{ end }}
- {{ end }}
- {{ end }}
- <!-- Keep backwards compatibility and consistency with HUGO defaults -->
- {{ if .Site.Config.Services.GoogleAnalytics.ID }}
- {{ template "_internal/google_analytics.html" . }}
- {{ end }}
|