1(function(){window.dataLayer=window.dataLayer||[];const CONVERSION_FLAG='lead_form_sent_once';const INTENT_FLAG='lead_form_intent';const SUCCESS_URL_REGEX=/gracias/i;const SUCCESS_MESSAGE_TEXT="Thank you for your message. It has been sent.";const SENSITIVE_FIELD_REGEX=/(email|mail|e-mail|phone|tel|telefono|nombre|name|apellido|lastname|dni|document)/i;function conversionAlreadySent(){return sessionStorage.getItem(CONVERSION_FLAG)==='true';} 2function markConversionSent(){sessionStorage.setItem(CONVERSION_FLAG,'true');} 3function markIntent(){sessionStorage.setItem(INTENT_FLAG,'true');} 4function hasIntent(){return sessionStorage.getItem(INTENT_FLAG)==='true';} 5async function hashValue(value){const encoder=new TextEncoder();const data=encoder.encode(value.trim().toLowerCase());const hashBuffer=await crypto.subtle.digest('SHA-256',data);return Array.from(new Uint8Array(hashBuffer)).map(b=>b.toString(16).padStart(2,'0')).join('');} 6async function extractFieldsFromPage(){const fields={};const inputs=document.querySelectorAll('input, select, textarea');for(const input of inputs){const key=input.name||input.id;const value=input.value;if(!key||!value)continue;fields[key]=SENSITIVE_FIELD_REGEX.test(key)?await hashValue(value):value;} 7return fields;} 8async function pushLeadEvent(){if(conversionAlreadySent())return;markConversionSent();const fields=await extractFieldsFromPage();window.dataLayer.push({event:"lead_form_sent",form_name:window.location.pathname,form_fields:fields});} 9document.addEventListener('submit',function(e){if(!(e.target instanceof HTMLFormElement))return;markIntent();},true);if(SUCCESS_URL_REGEX.test(window.location.pathname)&&hasIntent()){pushLeadEvent();} 10const observer=new MutationObserver(()=>{if(document.body.innerText.includes(SUCCESS_MESSAGE_TEXT)){markIntent();pushLeadEvent();observer.disconnect();}});observer.observe(document.body,{childList:true,subtree:true});})();
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.