Skip to content

Commit

Permalink
Removed Drift code
Browse files Browse the repository at this point in the history
  • Loading branch information
raj-bluetext committed Jul 19, 2024
1 parent 7d577cf commit e0f3113
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions blocks/marketo/marketo.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,43 @@ const embedMarketoForm = (marketoId, formId, successUrl) => {
if (successUrl) {
window.MktoForms2.loadForm('//go.merative.com', `${marketoId}`, formId, (form) => {
// Add an onSuccess handler
form.onSuccess((values) => {
form.onSuccess(() => {
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.error('Error with Drift API calls:', error);
// }
// });
// } else {
// // console.error('Drift is not defined');
// }
// Return false to prevent the submission handler continuing with its own processing
return false;
});
Expand Down

0 comments on commit e0f3113

Please sign in to comment.