Skip to content

Commit

Permalink
Added matomo support (hugo-toha#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddavo authored Aug 18, 2022
1 parent 55dd90a commit eefb616
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ A [Hugo](https://gohugo.io/) theme for a personal portfolio with minimalist desi
- GoatCounter
- counter.dev
- Google Analytics
- Matomo/Piwik
- Comment Support
- [Disqus](https://disqus.com/)
- [Valine](https://valine.js.org/)
Expand Down
18 changes: 18 additions & 0 deletions layouts/partials/analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@
src="//gc.zgo.at/count.js"
></script>
{{ 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 }}
{{ end }}
{{ end }}

Expand Down

0 comments on commit eefb616

Please sign in to comment.