diff --git a/internal/middleware/security.go b/internal/middleware/security.go index 3ca4e7b..39e20bb 100644 --- a/internal/middleware/security.go +++ b/internal/middleware/security.go @@ -30,11 +30,11 @@ func SecurityHeaders(next http.Handler) http.Handler { // Content Security Policy (comprehensive) csp := "default-src 'self'; " + - "script-src 'self' 'unsafe-inline' https://unpkg.com https://code.iconify.design; " + + "script-src 'self' 'unsafe-inline' https://unpkg.com https://code.iconify.design https://matomo.drolo.club; " + "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; " + "font-src 'self' https://fonts.gstatic.com; " + "img-src 'self' data: https:; " + - "connect-src 'self' https://api.iconify.design; " + + "connect-src 'self' https://api.iconify.design https://matomo.drolo.club; " + "frame-ancestors 'self'; " + "base-uri 'self'; " + "form-action 'self'" diff --git a/templates/index.html b/templates/index.html index 355eb14..8335309 100644 --- a/templates/index.html +++ b/templates/index.html @@ -619,6 +619,33 @@ console.log('HTMX request successful:', evt.detail.pathInfo.requestPath); } }); + + // Track HTMX navigation events with Matomo + document.body.addEventListener('htmx:afterSwap', function(evt) { + if (typeof _paq !== 'undefined' && evt.detail.target.id === 'cv-content') { + // Track language change as virtual pageview + const lang = new URLSearchParams(window.location.search).get('lang') || 'en'; + _paq.push(['setCustomUrl', window.location.href]); + _paq.push(['setDocumentTitle', document.title]); + _paq.push(['trackPageView']); + } + }); + + + +