Vi hör av oss inom 24 timmar!

function getDomainAndPage() { // Get the current URL var currentUrl = window.location.href; // Split the URL to extract the domain and page var urlParts = currentUrl.split("/"); var domain = urlParts[2]; // Get the domain var page = urlParts[urlParts.length - 1]; // Get the last part as page // Return domain and page as an object return { domain: domain, page: page }; } // Function to push domain/page information to Google Tag Manager function pushDataToGTM() { // Get domain and page information var domainAndPage = getDomainAndPage(); // Push domain and page information to dataLayer window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'domainPageInfo', 'domain': domainAndPage.domain, 'page': domainAndPage.page }); } // Call the function to push data to Google Tag Manager pushDataToGTM(); // Function to modify Contact Form 7 submission function modifyCF7Submission() { // Capture the form submission event document.addEventListener('wpcf7mailsent', function(event) { // Get the form element var form = event.detail.target; // Get domain and page information var domainAndPage = getDomainAndPage(); // Create a hidden input field for domain var domainInput = document.createElement('input'); domainInput.setAttribute('type', 'hidden'); domainInput.setAttribute('name', '_domain'); domainInput.setAttribute('value', domainAndPage.domain); // Create a hidden input field for page var pageInput = document.createElement('input'); pageInput.setAttribute('type', 'hidden'); pageInput.setAttribute('name', '_page'); pageInput.setAttribute('value', domainAndPage.page); // Append the hidden input fields to the form form.appendChild(domainInput); form.appendChild(pageInput); }, false); } // Call the function to modify CF7 submission modifyCF7Submission(); // Execute this function when the Contact Form 7 is submitted document.addEventListener('wpcf7mailsent', function(event) { var formData = getDomainAndPage(); // Push the domain and page information to the dataLayer window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'cf7Submission', 'domain': formData.domain, 'page': formData.page }); }, false);