_satellite["_runScript4"](function(event, target, Promise) { //google and floodlight conversion tracking window.addEventListener('load', function() { //account for multiple CTAs: const googleConversionElements = document.querySelectorAll('[data-conversion-id]'); const floodLightConversionElements = document.querySelectorAll('[data-fl-conversion-id]'); _satellite.logger.log("Step 1 googleConversionElements = "+googleConversionElements+"floodLightConversionElements = "+floodLightConversionElements); //Add click event listener for each google conversion element. googleConversionElements.forEach(element => { element.addEventListener('click', function() { const gConversionId = this.getAttribute('data-conversion-id'); _satellite.logger.log("Step 2 gConversionId = "+gConversionId); if (gConversionId) { gtag('event', 'conversion', { 'send_to': `AW-1001084592/${gConversionId}` }); } }); }); //Add click event listener for each floodlight conversion element. floodLightConversionElements.forEach(element => { element.addEventListener('click', function() { _satellite.logger.log('FL: flood light triggered.'); _satellite.logger.log("Step 3 FL Triggered "); const flConversionId = this.getAttribute('data-fl-conversion-id'); const queryParams = new URLSearchParams(window.location.search); const utmSource = (AvaTag.getCombinedData() && AvaTag.getCombinedData().vendor) ? AvaTag.getCombinedData().vendor : ''; const utmMedium = (AvaTag.getCombinedData() && AvaTag.getCombinedData().marketing_channel) ? AvaTag.getCombinedData().marketing_channel : ''; console.log("Step 4 FL Triggered flConversionId = "+flConversionId); if (flConversionId) { _satellite.logger.log(`FL: flood light triggered: ${flConversionId}`); _satellite.logger.log("Step 5 flConversionId = "+flConversionId); let eventName, actionSource; if (utmSource && utmMedium && (utmSource === 'paid_social' || utmSource === 'fb') && (utmMedium === 'fb' || utmMedium === 'paid_social')) { if (flConversionId === 'nofor0/u_cal0+unique') { eventName = 'Contact'; actionSource = 'phone_call'; } else if (flConversionId === 'nofor0/u_ava0+unique') { eventName = 'View Content'; actionSource = 'website'; } } const gtagData = { 'allow_custom_scripts': true, 'u7': window.location.href, 'send_to': 'DC-10443471/' + flConversionId }; // add u9 and u10 if present if (utmSource) { gtagData.u9 = utmSource; } if (utmMedium) { gtagData.u10 = utmMedium; } gtag('event', 'conversion', gtagData); } }); }); }); });