1/** 2 * Matomo Form Analytics Activation 3 * Enables automatic form tracking through Matomo's built-in Form Analytics feature 4 */ 5 6export function matomoFormAnalytics() { 7 document.addEventListener('DOMContentLoaded', function() { 8 if (typeof _paq !== 'undefined') { 9 // Dies startet das automatische Tracking aller Formulare durch Matomo Form Analytics 10 // DIESER TEIL IST NEU/ZUSÃTZLICH FÃR FORM ANALYTICS 11 _paq.push(['FormAnalytics::trackAllForms']); 12 console.log('Matomo Form Analytics initialisiert und versucht, Formulare zu tracken.'); 13 14 // Debug: Check which forms are found 15 setTimeout(function() { 16 const forms = document.querySelectorAll('form, .wpcf7-form'); 17 console.log('Gefundene Formulare für Form Analytics:', forms.length); 18 forms.forEach((form, index) => { 19 console.log(`Form ${index + 1}:`, { 20 id: form.id || 'Keine HTML-ID', 21 className: form.className, 22 name: form.name || 'Kein Name', 23 action: form.action || 'Keine Action', 24 // Check for Contact Form 7 specific attributes 25 'data-cf7': form.getAttribute('data-cf7') || 'Nicht gefunden', 26 'CF7 Post ID': form.closest('.wpcf7')?.querySelector('input[name="_wpcf7"]')?.value || 'Nicht gefunden' 27 }); 28 }); 29 30 // Check if Form Analytics is actually loaded 31 if (typeof window.Matomo !== 'undefined' && window.Matomo.FormAnalytics) { 32 console.log('â Form Analytics Plugin ist geladen'); 33 } else { 34 console.warn('â ï¸ Form Analytics Plugin scheint nicht geladen zu sein'); 35 } 36 }, 1000); 37 38 } else { 39 console.warn('Matomo (_paq) nicht verfügbar - Form Analytics kann nicht aktiviert werden'); 40 } 41 }); 42}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.