//tagmanager
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
if(event.detail.contactFormId == ‘389’){
var theEmail = ”;
event.detail.inputs.forEach(function(item){
if(item.name == ‘your-email’){
theEmail = item.value;
}
});
window.location = ‘https://illuminated-integration.com/thank-you/?userEmail=’ + theEmail;
}
});
//on-page
(function(n,u,t){n[u]=n[u]||function(){(n[u].q=n[u].q||[]).push(arguments)}}(window,’Nutsheller’));
var queryParams = new URLSearchParams(window.location.search);
if(queryParams.has(‘userEmail’)){
document.querySelector(‘#theMessage p’).innerText = ‘Please submit some additional information so we can easily help quote your project!’;
Nutsheller(‘initForm’, {form: ‘7ovjsc’, instance: ‘349206’, target: ‘nutshell-form-7ovjsc’});
var observer = new MutationObserver( function( mutations, observer ) {
console.log(document.querySelector(‘#nutshell-form-7ovjsc input[type=”email”]’));
if(document.querySelector(‘#nutshell-form-7ovjsc input[type=”email”]’)){
document.querySelector(‘#nutshell-form-7ovjsc input[type=”email”]’).value = queryParams.get(‘userEmail’);
console.log(document.querySelector(‘#nutshell-form-7ovjsc input[type=”email”]’).value);
observer.disconnect();
}
});
var target = document.querySelector( ‘#nutshell-form-7ovjsc’ );
observer.observe( target, {
attributes: true,
childList: true,
subtree: true
});
}