diff --git a/blocks/marketo/marketo.js b/blocks/marketo/marketo.js index 3e078b43..5e836201 100644 --- a/blocks/marketo/marketo.js +++ b/blocks/marketo/marketo.js @@ -28,42 +28,48 @@ const embedMarketoForm = (marketoId, formId, successUrl) => { window.MktoForms2.loadForm('//go.merative.com', `${marketoId}`, formId, (form) => { // Add an onSuccess handler form.onSuccess(() => { - location.href = successUrl; - if (window._satellite) { - _satellite.track('formSubmit', { - formName: document.title, - }); - } + // location.href = successUrl; + // if (window._satellite) { + // _satellite.track('formSubmit', { + // formName: document.title, + // }); + // } // Drift API call to commit form data immediately upon form submit - // if (typeof drift !== 'undefined') { - // drift.on('ready', (api) => { - // try { - // api.commitFormData({ - // campaignId: 2787244, - // }); + if (typeof drift !== 'undefined') { + drift.on('ready', (api) => { + try { + api.commitFormData({ + campaignId: 2787244, + }); - // if (location.href.includes('/contact')) { - // // Drift popup custom code - // drift.api.collectFormData(values, { - // campaignId: 2787244, - // followupUrl: successUrl, - // stageData: true, - // }); - // } + if (location.href.includes('/contact')) { + // Drift popup custom code + drift.api.collectFormData(values, { + campaignId: 2787244, + followupUrl: successUrl, + stageData: true, + }); + } - // // Adobe Launch tracking for form submission - // if (window._satellite) { - // _satellite.track('formSubmit', { - // formName: document.title, - // }); - // } - // } catch (error) { - // // console.error('Error with Drift API calls:', error); - // } - // }); - // } else { - // // console.error('Drift is not defined'); - // } + // Adobe Launch tracking for form submission + if (window._satellite) { + _satellite.track('formSubmit', { + formName: document.title, + }); + } + } catch (error) { + console.log('Error with Drift API calls:', error); + } + }); + } else { + console.log('Drift is not defined'); + location.href = successUrl; + if (window._satellite) { + _satellite.track('formSubmit', { + formName: document.title, + }); + } + } // Return false to prevent the submission handler continuing with its own processing return false; });