Grab Marketo Form in Liferay for Drift | Community
Skip to main content
Level 2
April 11, 2023
Solved

Grab Marketo Form in Liferay for Drift

  • April 11, 2023
  • 3 replies
  • 3144 views

Hello,

 

We are trying to add a Marketo Form to our landing page that is using Liferay for a Drift fastlane integration. 

 

I am not sure how to grab a Marketo form outside of Marketo. I have the instance and form ID, would it just be as simple as pasting a script in the Liferay html?

 

I have added sample code with different values below on how we are trying to grab the form.

 

<!-- Drift --> <script> MktoForms2.loadForm("//website.com", "658-grs-4469", 3267, function (form) { form.onSuccess(function (values) { drift.api.collectFormData(values, { campaignId: 5624457, // Drift playbook's campaign id! followupUrl: 'website.com' }); return false; }); }); </script>

 

Thanks,

Oscar

Best answer by Darshil_Shah1

I believe OP is trying to fire a Drift fast lane playbook (a full-screen chat) when a user submits the form. Upon a successful Marketo form submission, the Drift JavaScript  will collect the form data and fire the playbook. Check out this documentation on plugging Drift fastlane playbook into form workflow. @oaj ,do you see any console errors when you try this code in action? Or let us know if you’re trying to do something else. 

3 replies

Jo_Pitts1
Community Advisor
Community Advisor
April 11, 2023

@oaj ,

are you trying to embed a Marketo form on a non Marketo landing page?  I'm a bit confused by the question.

If that is the case, just use Marketo's form embed code.  When you click on a form in the LHS treeview, you'll see a button at the top RHS called embed code.  Click it.  Copy that code into your landing page.

 

Or are you trying to send data in the Marketo form to Liferay?

 

 

Regards

Jo

SanfordWhiteman
Level 10
April 11, 2023

Every Marketo form has a form embed code. Not sure what else you mean by "grab".

Darshil_Shah1
Community Advisor and Adobe Champion
Darshil_Shah1Community Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
April 12, 2023

I believe OP is trying to fire a Drift fast lane playbook (a full-screen chat) when a user submits the form. Upon a successful Marketo form submission, the Drift JavaScript  will collect the form data and fire the playbook. Check out this documentation on plugging Drift fastlane playbook into form workflow. @oaj ,do you see any console errors when you try this code in action? Or let us know if you’re trying to do something else. 

SanfordWhiteman
Level 10
April 12, 2023

You wouldn't use the code above without previously including forms2.min.js. And if you include the entire embed code above this, you'd end up duplicating the form.

 

@oaj it's not recommended to use the immediate onReady listener — the 4th argument to loadForm() — unless you're very sure of what you’re doing.

 

Instead, include the standard embed code. Then after that, include a whenReady listener with your custom behavior:

MktoForms2.whenReady(function(form){ form.onSuccess(function(values, originalThankYouURL) { drift.api.collectFormData(values, { campaignId: 5624457, // Drift playbook's campaign id! followupUrl: 'website.com' }); return false; }); });