Skip to content

Commit

Permalink
Testing drift code 1
Browse files Browse the repository at this point in the history
  • Loading branch information
raj-bluetext committed Jun 4, 2024
1 parent 4cd4a5c commit 47165aa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions blocks/marketo/marketo.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ const embedMarketoForm = (marketoId, formId, successUrl) => {
window.MktoForms2.loadForm('//go.merative.com', `${marketoId}`, formId, (form) => {
// Add an onSuccess handler
// eslint-disable-next-line no-unused-vars
// drift.on('ready', function (api) {
// api.commitFormData({
// campaignId: 2787244
// });
// });
form.onSuccess((values, followUpUrl) => {
// Take the lead to a different page on successful submit,
// ignoring the form's configured followUpUrl
Expand All @@ -37,11 +42,22 @@ const embedMarketoForm = (marketoId, formId, successUrl) => {
formName: document.title,
});
}
drift.on('ready', function (api) {
console.log('drift');
try {
api.commitFormData({
campaignId: 2787244
});
} catch (error) {
console.error('Error committing form data to Drift:', error);
}
});
// Drift popup custom code
drift.api.collectFormData(values, {
campaignId: 2787244,
// followupUrl: 'https://www.merative.com/thank-you',
followupUrl: successUrl,
stageData: true
});
// Return false to prevent the submission handler continuing with its own processing
return false;
Expand Down

0 comments on commit 47165aa

Please sign in to comment.