OptinMonster Documentation

Documentation, Reference Materials, and Tutorials for OptinMonster

Home

Docs

How to Connect OptinMonster with a Custom Marketo Form

How to Connect OptinMonster with a Custom Marketo Form

In addition to our native Marketo integration, OptinMonster makes it easy for you to use a custom Marketo form in your campaigns. You can use a custom Marketo form to add additional fields to your form or other custom functionality.

In this article, you’ll learn how to add a custom Marketo form to your OptinMonster campaign.

Before You Start

Here are some things to know before you begin:

  • This article assumes you’ve already created an OptinMonster campaign to integrate your custom Marketo form with.
  • Custom Marketo forms don’t automatically track conversions when they are submitted in OptinMonster. It’s important to update your custom Marketo form code as instructed in this guide.
  • You may need to add custom CSS to style your form as desired. Custom Marketo forms do not automatically inherit the campaign’s template styling.
  • The form’s Success Action will be controlled by the code modifications you use in this guide.

Get Started With OptinMonster Today!

BONUS: Done-For-You Campaign Setup ($297 value)
Our conversion experts will design 1 free campaign for you to get maximum results – absolutely FREE! Click here to get started →

Edit Form Code

Before your custom Marketo form can work in OptinMonster, you’ll need to make a few modifications to the embed code you’re provided.

The embed code you receive will look something like the following:

<script src="//app-aba.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_#####"></form>
<script>MktoForms2.loadForm("//app-aba.marketo.com", "###-LLL-###", #####);</script>
You’ll need to add:
  • A div with the ID optinmonster-form-success below the Marketo form code with your success message.
  • The onSuccess function to track conversions as outlined below.

The above modifications will cause your form code to look similar to the following:

<script src="//app-aba.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_#####"></form>
<script>
    MktoForms2.loadForm("//app-aba.marketo.com", "###-LLL-###", #####, function(form) {
        var formEl = form.getFormElem()[0];
        var submitEl = formEl.querySelector('button[type="submit"]');
        form.onSuccess(function(values, followUpUrl) {
            // Get the form's jQuery element and hide it
            form.getFormElem().hide();
            
            // Trigger a conversion of the form
            om{{id}}.Listeners.convert();

            // Show Success view
            // Remove if you prefer to close the campaign or redirect on submission
            om{{id}}.changeView('success');

            // Close the campaign
            // Remove if you prefer to show the success view or redirect on submission
            om{{id}}.startClose();

            // Return false to prevent the submission handler from taking the lead to the follow up url
            // Remove if you want to redirect the visitor as configured in the Marketo form builder
            return false;
        });
    });
</script>
Important: edit the code above following the comments to control what Success Action takes place when the form is submitted. You can show the Success view, close the campaign, or redirect the visitor to the URL indicated when you configured the form in Marketo.

Add Custom Marketo Form

You can add extra fields to your form or include other custom functionality using a custom Marketo form in OptinMonster.

To add a custom Marketo form to your OptinMonster campaign, follow these steps:

  1. Log into your Marketo account and create the form you wish to add to your OptinMonster campaign.
  2. Follow the instructions provided in the previous section of this guide to edit the form embed code Marketo provided you with.
  3. Next, follow our Custom HTML integration guide to add the form code to your campaign.
  4. When you’re finished, click Save.

Troubleshooting

What does the onSuccess code do?

The onSuccess addition allows your campaign to track conversions and set a cookie when the form is successfully submitted. Without this addition, no conversions will be tracked or cookies set on form submission.

Email Automations

To send emails automatically to new leads you’ll want to configure email automations within your Marketo account.

The following guides from Marketo may be helpful to get started:


Still stuck?

How can we help?

Last updated on


Start Getting More
Leads & Sales Today
with OptinMonster!

Create and launch smart capture forms today in minutes. What are you waiting for?

Create and launch smart capture forms
today in minutes. What are you waiting for?

OptinMonster has transformed our business. Before integrating their optins, our clients saw a 2% conversion rate from web traffic, which is slightly above the standard for their industry. With the integration of OptinMonster’s lightbox popup, exit-intent technology, split testing, and other tools, our client’s conversion rates soared by an unprecedented 500%. They attracted substantially more customers while spending less on digital advertising. Their success propelled them to the top of their markets, outperforming national chains and other medical spas with much bigger marketing budgets. Our client’s success in their market has distinguished us in our own. We are now one of the most sought-after marketing firms in the industry of aesthetic medicine. We know that the integration of OptinMonster, more than any other tool or marketing strategy, has supported this growth and achievement.

chris zelig medstar media

Chris Zelig

Partner, Medstar Media

OptinMonster has been a game-changer for us. From driving donations to collecting new leads, there is nothing that this simple tool has failed to accomplish. Our lead collection rate has jumped by over 1,000%.

joe lowe american bird conservancy

Joe Lowe

Director of Digital Communications, American Bird Conservancy

Through OptinMonster’s exit-intent popups, we have more than doubled our sales conversion rate. Best of all is the compound effect of using OptinMonster over a long period of time—more conversions mean more customers, which means more word of mouth.

mitch smith, managing director, shockbyte

Mitch Smith

Managing Director, Shockbyte.com