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 #386

Merged
merged 6 commits into from
Jul 19, 2024
Merged
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
43 changes: 32 additions & 11 deletions blocks/marketo/marketo.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,43 @@ const embedMarketoForm = (marketoId, formId, successUrl) => {
if (successUrl) {
window.MktoForms2.loadForm('//go.merative.com', `${marketoId}`, formId, (form) => {
// Add an onSuccess handler
// eslint-disable-next-line no-unused-vars
form.onSuccess((values, followUpUrl) => {
// Take the lead to a different page on successful submit,
// ignoring the form's configured followUpUrl
// location.href = successUrl;
form.onSuccess(() => {
location.href = successUrl;
if (window._satellite) {
_satellite.track('formSubmit', {
formName: document.title,
});
}
// Drift popup custom code
drift.api.collectFormData(values, {
campaignId: 2787244,
// followupUrl: 'https://www.merative.com/thank-you',
followupUrl: successUrl,
});
// 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 (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');
// }
// Return false to prevent the submission handler continuing with its own processing
return false;
});
Expand Down
Loading