mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
implemented cross-domain matomo tracking on nginx level
This commit is contained in:
@@ -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
|
14
roles/nginx-matomo-tracking/templates/matomo-tracking.js.j2
Normal file
14
roles/nginx-matomo-tracking/templates/matomo-tracking.js.j2
Normal 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);
|
||||
})();
|
Reference in New Issue
Block a user