1const utmMatchObject={UTM_Source_Most_Recent__c:"utm_source",UTM_Medium_Most_Recent__c:"utm_medium",utm_campaign_most_recent__c:"utm_campaign",UTM_Content_Most_Recent__c:"utm_content",UTM_Term_Most_Recent__c:"utm_term",UTM_Source_Original__c:"utm_source",UTM_Medium_Original__c:"utm_medium",UTM_Campaign_Original__c:"utm_campaign",UTM_Content_Original__c:"utm_content",UTM_Term_Original__c:"utm_term"},utmHubspotMatchObject={utm_source_most_recent__c:"utm_source_recent",utm_medium_most_recent__c:"utm_medium_recent",utm_campaign_most_recent__c:"utm_campaign_recent",utm_content_most_recent__c:"utm_content_recent",utm_term_most_recent__c:"utm_term_recent",utm_source_original__c:"utm_source",utm_medium_original__c:"utm_medium",utm_campaign_original__c:"utm_campaign",utm_content_original__c:"utm_content",utm_term_original__c:"utm_term"};function initUtm(){if(!urlHasUtms())return window.requestAnimationFrame(updateTrackingUrls),!1;["utm_source","utm_medium","utm_campaign","utm_content","utm_term"].forEach(utmValue=>grabAndApply(utmValue)),window.requestAnimationFrame(updateTrackingUrls);document.querySelectorAll("form").forEach(form=>{const payload={detail:{form:form,formId:form.getAttribute("data-form-id"),formLocale:document.documentElement.lang||"en"}};window.applyHubspotFormUtms(payload)})}function updateTrackingUrls(){"function"==typeof window.updateSignUpUrl&&window.updateSignUpUrl(),"function"==typeof window.updateCheckoutUrls&&window.updateCheckoutUrls()}function applyHubspotFormUtms(event){if(!event||!event.detail||!event.detail.form)return console.error("Form object not found in event.detail"),!1;const form=event.detail.form;if(form.querySelectorAll('input[name*="utm"]').length>0&&storageHasUtms()){Object.keys(utmHubspotMatchObject).forEach(hbsptUtmName=>{const storageValue=sessionStorage.getItem(utmHubspotMatchObject[hbsptUtmName]),hbsptInput=form.querySelector(`input[name="${hbsptUtmName}"]`);hbsptInput&&storageValue&&(hbsptInput.value=storageValue)})}return!1}function grabAndApply(value){handleApplyingStorage(value,getParameterByName(value))}function getParameterByName(utmName){const cleanUtmName=utmName.replace(/[[]/,"\\[").replace(/[\]]/,"\\]"),results=new RegExp("[\\?&]"+cleanUtmName+"=([^&#]*)").exec(window.location.search);return null===results?"":decodeURIComponent(results[1].replace(/\+/g," "))}function utmRegexCheck(utmValue){return/utm/.test(utmValue)}function urlHasUtms(){const locSearch=window.location.search;return!!locSearch&&locSearch.indexOf("utm")>-1}function storageHasUtms(){return Object.keys(window.sessionStorage).some(utmRegexCheck)}function handleApplyingStorage(key,value){if(sessionStorage.getItem(key))sessionStorage.setItem(key+"_recent",value);else{if(!value)return!1;sessionStorage.setItem(key,value),sessionStorage.setItem(key+"_recent",value)}}function removeUTMConsent(){Object.values(utmMatchObject).forEach(key=>{sessionStorage.removeItem(key),sessionStorage.removeItem(key+"_recent")})}function trackingListener(){var ct=document.createElement("img");ct.src="https://ct.capterra.com/capterra_tracker.gif?vid=2116650&vkey=488a218f340f64282dd4b43a732267c0",document.body.appendChild(ct)}function shouldRunTrackingListener(){const utmSourceRecent=sessionStorage.getItem("utm_source_recent"),utmSource=sessionStorage.getItem("utm_source");return"capterra"===utmSourceRecent||"capterra"===utmSource}window.initUtm=initUtm,window.applyHubspotFormUtms=applyHubspotFormUtms,window.removeUTMConsent=removeUTMConsent,document.addEventListener("DOMContentLoaded",function(){addConsentChangeListener("C0004",initUtm,removeUTMConsent)}),window.addEventListener("message",function(event){if("hsFormCallback"===event.data.type&&("onFormSubmitted"===event.data.eventName&&shouldRunTrackingListener()&&trackingListener(),"onFormReady"===event.data.eventName)){var formElement=document.querySelector(`form[data-form-id="${event.data.id}"]`),formLocale=document.documentElement.lang||"en";const payload={detail:{form:formElement,formId:event.data.id,formLocale:formLocale}};window.applyHubspotFormUtms(payload)}}); 2//# sourceURL=https://45424130.fs1.hubspotusercontent-na1.net/hubfs/45424130/hub_generated/template_assets/1/185459393118/1790942371938/template_utmLogic.js
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.