We'd love to work together.
Tell us a little about yourself and a partnership expert will get in touch soon!
We look forward to connecting.
|
initForms()
function initForms() { updateMarketingUtmCookies() addMarketingFormBlockListeners()
}
function getMktoScrollPosition(element) { var distance = 0 while (element) { distance += (element.offsetTop - element.scrollTop + element.clientTop) element = element.offsetParent } return distance }
function addMarketingFormBlockListeners() { if (typeof MktoForms2 !== 'undefined') { MktoForms2.whenReady(form => { var formEl = form.getFormElem()[0]; formEl.setAttribute("data-inline-behaviors-loaded", "false"); pullMarketingUtmCookies(form) form.onValidate(() => { form.getFormElem()[0].classList.add('submitted') }) form.onSuccess((values, followUpUrl) => {
const thankYou = form.getFormElem()[0].nextElementSibling.nextElementSibling let success_url = false;
if(thankYou && thankYou.dataset && typeof(thankYou.dataset.success_url) !== undefined && thankYou.dataset.success_url != ""){ success_url = thankYou.dataset.success_url; }
if(success_url){ window.location.href = thankYou.dataset.success_url; return false; } else if (thankYou && thankYou.innerHTML && thankYou.innerHTML !== '') { thankYou.innerHTML = atob(thankYou.innerHTML) form.getFormElem().hide() thankYou.style.display = 'block' window.scrollTo(0, getMktoScrollPosition(thankYou) - 100) return false } else { window.location.assign("/thank-you-contact-us/"); return false; } }) })
MktoForms2.whenRendered(function (form) { destyleMktoForm(form); });
} }
function destyleMktoForm(mktoForm, moreStyles) {
// removing the marketto theme files let mktoForms2BaseStyle = document.querySelector('#mktoForms2BaseStyle') if (mktoForms2BaseStyle) { mktoForms2BaseStyle.remove(); } let mktoForms2ThemeStyle = document.querySelector('#mktoForms2ThemeStyle') if (mktoForms2ThemeStyle) { mktoForms2ThemeStyle.remove(); }
//Hacky methood for removing the marketto styles from the embeded forms var loadedStyles = document.getElementsByTagName("style") for (let i = 0; i < loadedStyles.length; i++) { let loadedStyleHtml = loadedStyles[i].innerHTML; let searchSrr = '@import url("https://cdn.cnetcontent.com/sites/2021/cswf.css");' let splitContent = loadedStyleHtml.split(searchSrr); loadedStyles[i].innerHTML = splitContent.join(' '); } let LbloptInConsent = document.getElementById("LbloptInConsent") if(LbloptInConsent){ var lbloptInConsentHtml = LbloptInConsent.parentElement.innerHTML; var newLbloptInConsentHtml = "
"; LbloptInConsent.parentElement.innerHTML = newLbloptInConsentHtml; }
}
function updateMarketingUtmCookies() { if (location.search) { let keyValuePairs = location.search.substr(1).split('&') keyValuePairs.forEach(keyValuePair => { const temp = keyValuePair.split('=') const key = temp[0] const value = temp[1] if (key.indexOf('utm_') === 0 || key === 'gclid') { document.cookie = `${key}=${value}; path=/` } }) } document.cookie = `referrer=${document.referrer}; path=/` }
function pullMarketingUtmCookies(f) { const cookies = document.cookie.split('; ').filter(cookie => { return cookie.indexOf('utm_') === 0 || cookie.indexOf('gclid') }) cookies.forEach(cookie => { const temp = cookie.split('=') const field = temp[0] const value = temp[1] f.vals({ [field]: value }) }) }
function isValidHttpUrl(string) { let url;
try { url = new URL(string); } catch (_) { return false; }
return url.protocol === "http:" || url.protocol === "https:"; }