Skip to content

Commit

Permalink
feat(analytics): add Umami and Matomo tracking codes (cotes2020#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
ildoc authored Apr 9, 2024
1 parent 23be416 commit 61bdca2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
- Built-in Search
- Atom Feeds
- PWA
- Google Analytics / GoatCounter
- Web Analytics
- SEO & Performance Optimization

## Documentation
Expand Down
6 changes: 6 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ analytics:
id: # fill in your Google Analytics ID
goatcounter:
id: # fill in your GoatCounter ID
umami:
id: # fill in your Umami ID
domain: # fill in your Umami domain
matomo:
id: # fill in your Matomo ID
domain: # fill in your Matomo domain

# Pageviews settings
pageviews:
Expand Down
14 changes: 14 additions & 0 deletions _includes/analytics/matomo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//{{ site.analytics.matomo.domain }}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', {{ site.analytics.matomo.id }}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
6 changes: 6 additions & 0 deletions _includes/analytics/umami.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- Umami -->
<script
defer
src="{{ site.analytics.umami.domain }}/script.js"
data-website-id="{{ site.analytics.umami.id }}"
></script>

0 comments on commit 61bdca2

Please sign in to comment.