Embedding Marketo Web Form

MariaT
Level 1

I've been trying to test Smart Campaigns using Fill Out WEb Form as a trigger. Unfortunately, embedding a web form doesn't work for me. I have no JS errrors but the request is not sent.

This is my test webpage with embedded form code:

<!doctype html>
<html>
  <head>
    <title>My Test form</title>
    <script src="https://[MYHOST]/js/forms2/js/forms2.min.js"></script>
  </head>
  <body>
    <form id="mktoForm_1001"></form>

    <script>
      MktoForms2.loadForm(
        "https://[MYHOST]",
        "091-LGJ-090",
        1001);
    </script>
  </body>
</html>

no request is made when I submit, it just hags with a "please wait" button. Is it something wrong with my form in Marketo or with the js code?

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator
Please link to your page. There's no way to tell, from just that markup, what else you might be including in the form (e.g. in a rich text area) that's breaking submission.
PeeyushSachdeva
Level 4

Hi @MariaT ,

 

A few things to double-check:

  • Use the exact embed code from Marketo
    In Form → Actions → Embed Code, copy the snippet and paste it as-is.
    In particular, both of these values must match what Marketo gives you:
<script src="//xxx-xxx-xxx.mktoweb.com/js/forms2/js/forms2.min.js"></script> 

<form id="mktoForm_1306"></form> 
<script>MktoForms2.loadForm("//xxx-xxx-xxx.mktoweb.com", "xxx-xxx-xxx", 1306);</script>


https://[MYHOST] should be your munchkin, not just any random site host.

SanfordWhiteman
Level 10 - Community Moderator
Well, it's pretty unlikely there's anything wrong with the embed code itself if the form is showing up.

But you're right, it only adds confusion if you don't copy and paste the embed code as-is when testing. There are good reasons to load the library only once (e.g. in the head) but you work those out *after* testing the basic functionality.