Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 963 deferred form #388

Closed
wants to merge 9 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 39 additions & 33 deletions blocks/marketo/marketo.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,48 @@
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);

Check warning on line 61 in blocks/marketo/marketo.js

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
}
});
} else {
console.log('Drift is not defined');

Check warning on line 65 in blocks/marketo/marketo.js

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
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;
});
Expand Down
Loading