implemented cross-domain matomo tracking on nginx level

This commit is contained in:
2023-11-18 20:02:55 +01:00
parent f285f2b46e
commit a60ec9fa21
54 changed files with 182 additions and 64 deletions

View File

@@ -0,0 +1,5 @@
# sub filters to integrate matomo tracking code in nginx websites
sub_filter '</head>' '<script>{{matomo_tracking_code_one_liner}}</script></head>';
sub_filter '</body>' '<noscript><p><img src="//matomo.veen.world/matomo.php?idsite={{matomo_site_id}}&rec=1" style="border:0;" alt="" /></p></noscript></body>';
sub_filter_once off;
# sub_filter_types text/html; This is standart

View File

@@ -0,0 +1,14 @@
var _paq = window._paq = window._paq || [];
_paq.push(["setCookieDomain", "*.{{base_domain}}"]);
_paq.push(["setDomains", ["*.{{base_domain}}"]]);
_paq.push(["enableCrossDomainLinking"]);
_paq.push(["trackPageView"]);
_paq.push(["trackAllContentImpressions"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u="//{{matomo_domain}}/";
_paq.push(["setTrackerUrl", u+"matomo.php"]);
_paq.push(["setSiteId", "{{matomo_site_id}}"]);
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);
})();