1//Must be set as a global variable 2const eHawkTalonSettings = { 3 cookie: { 4 SameSite: 'Strict', 5 Secure: true, 6 Path: '/', 7 }, 8 bind: { 9 OutId: 'talon6', 10 }, 11 //autoLoad: false, 12}; 13 14// Ehawk execution script 15function createEhawkTextarea() { 16 const ehawkTextArea = document.createElement( 'textarea' ); 17 ehawkTextArea.id = 'talon6'; 18 ehawkTextArea.value = '{"version": 6, "status": -1}'; 19 ehawkTextArea.rows = 10; 20 ehawkTextArea.cols = 100; 21 ehawkTextArea.style.display = 'none'; 22 ehawkTextArea.classList.add( 'none' ); 23 document.body.appendChild( ehawkTextArea ); 24} 25// load talon script and return promise when done 26const loadScript = ( src ) => new Promise( ( resolve ) => { 27 const script = document.createElement( 'script' ); 28 script.src = src; 29 script.addEventListener( 'load', resolve ); 30 document.head.appendChild( script ); 31} ); 32// After talon runs, copy fingerprint value to all fields with the name of salmon 33function populateSalmons( talonValue ) { 34 const salmons = document.querySelectorAll( 'input[name="salmon"]' ); 35 if ( salmons ) { 36 salmons.forEach( ( field ) => { 37 field.value = talonValue; 38 } ); 39 } 40} 41 42async function execTalon() { 43 let host = 'https://www.activecampaign.com'; 44 createEhawkTextarea(); 45 if ( location.hostname !== 'www.activecampaign.com' ) { 46 host = 'https://marketing.staging.app-us1.com'; 47 } 48 const loadingScript = loadScript( host + '/dist/scripts/EHawkTalon6.js' ); 49 await loadingScript; 50 //after script has loaded, run talon function 51 await Talon.eHawkTalon(); 52 const maxAttempts = 50; // ~5 seconds 53 let count = 0; 54 //check that ehawk is fully initialized (and is not -2 status) 55 const ehawkInitCheck = setInterval( () => { 56 ++count; 57 const tal = document.getElementById( 'talon6' ); 58 if ( tal && tal.value ) { 59 try { 60 const parsedTalon = JSON.parse( tal.value ); 61 if ( parsedTalon ) { 62 if ( parsedTalon.status !== -2 ) { 63 populateSalmons( tal.value ); 64 clearInterval( ehawkInitCheck ); 65 } 66 } 67 if ( count >= maxAttempts ) { 68 console.warn( 'eHawk Talon did not initialize' ); 69 clearInterval( ehawkInitCheck ); 70 } 71 } catch ( e ) { 72 console.warn( 'Error Parsing Talon' ); 73 } 74 } 75 }, 100 ); 76} 77execTalon();
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.