How to: Add Hidden Fields in OptinMonster and Sync Them with Marketo

So you want to use OptinMonster forms?  If you’re using Marketo, you’re going to get form submission errors.  Here’s how I got Marketo and OptinMonster to communicate (so you don’t have to troubleshoot with a web master, two support teams, a solutions architect, and the MOPs Pros Slack community 🤪).

>> Related: How to: Capture URL Parameters in Marketo with Cookies <<

The problem

Our clients had a simple request:  capture hidden UTMs on an OptinMonster form and match that data to the email record in a Marketo campaign.  But during testing, it just didn’t work and Marketo/OptinMonster weren’t communicating.

Worse, the documentation from OptInMonster didn’t cut it.  Our Solutions Architect couldn’t figure it out, and several folks on the MOPS Pros Slack channel were running into the same issue.  Ultimately I spent 3 weeks being punted from one support team to another. #notimpressed

The solution: ditch the standard Marketo integration

It turns out to add the hidden fields, do not use the standard Marketo integration.


  • Create an OptinMonster campaign using the “custom HTML integration
  • Create your hidden fields in the new OptinMonster campaign
  • Apply OptinMonster’s code snippet to your landing page
  • Personalize the code with your Marketo form ID, page URL, etc.

Finessing the CSS

At this point, the form looked… weird, and the CSS in Marketo and OptinMonster were competing.  I ended up tweaking the form CSS exclusively in Marketo until it looked right.

I also found that making a field “required” had to be controlled in Marketo.

Resolving the submission error/confirmation-success-block

Upon testing, the form still wouldn’t work and I was getting a confirmation-success-block.  Apparently so was everyone else in the MOPs Pros Slack community!

To their credit, OptinMonster responded immediately to the support ticket:

“That is a CORS error. The submission request is being made on an iframe under the domain which Marketo is rejecting as a valid origin. The success message is not being displayed because the form submission is failing.”

This fix was pretty simple — the client’s web admin whitelisted the subdomain.

Not done yet…

You still with me?  We were starting to see test leads (and their UTMs) syncing to Marketo, but the form itself wouldn’t display a success message, such as “Thank you!  You’ve been subscribed to our blog!”

Ultimately I had to comment out this line from the form code: om{{id}}.startClose();

And voila!  It finally worked.

OptinMonster form admin going forward

Some things to keep in mind:

  • For every OptinMonster campaign, you have to clone/create a unique Marketo form.
  • You can do all this testing/finessing in OptinMonster’s testing window.  Set it to only recognize you on the website right now so no one sees the form until it’s ready.


Curious if you’re leveraging the full power of your marketing tech stack?  Request a martech audit and we’ll benchmark your setup.

Sponge | Marketing Operations

Get a System Audit

Whether you inherited a new instance or just want a second opinion, we'll dive in and benchmark your tech stack.

Sponge | Marketing Operations

Download Resource

Use this form to recieve your free resource in your inbox today!