SOLVED

External Webpage, external form, but want to pass back a form fill activity

Go to solution
Bryant_Chang
Level 3

External Webpage, external form, but want to pass back a form fill activity

Developer question,

I am using an external webpage and external form for our homepage.

We want to be able to pass back a "filled out form" activity when they fill out that external form on our homepage.

looking at the resource page on munchkin, we are only able to push back "associatelead, clickedlink, visitedwebpage" activity types.

Is there resource on how we can push back a filled our form activity type?

Thanks

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: External Webpage, external form, but want to pass back a form fill activity

You don't use Munchkin for that, you use the Forms 2.0 API.

Create a dummy Marketo form to use for logging.  Then, in your external form's onsubmit (everything in {} is to be customized for your install):

var formEl = document.createElement('FORM');

formEl.id = 'mktoForm_' + {formid};

formEl.style.display = 'none';

document.body.appendChild(formEl);

MktoForms2.loadForm('//{instancename}.marketo.com', '{MUNC-HKIN-CODE}', {formid}, function(form) {

    form.submit()

});

Of course, even easier is switching to using embedded Marketo forms on your external website and tossing your other form.  It avoids duplicate work and gets the fields in Marketo where they (presumably) belong.

View solution in original post

7 REPLIES 7
SanfordWhiteman
Level 10 - Community Moderator

Re: External Webpage, external form, but want to pass back a form fill activity

You don't use Munchkin for that, you use the Forms 2.0 API.

Create a dummy Marketo form to use for logging.  Then, in your external form's onsubmit (everything in {} is to be customized for your install):

var formEl = document.createElement('FORM');

formEl.id = 'mktoForm_' + {formid};

formEl.style.display = 'none';

document.body.appendChild(formEl);

MktoForms2.loadForm('//{instancename}.marketo.com', '{MUNC-HKIN-CODE}', {formid}, function(form) {

    form.submit()

});

Of course, even easier is switching to using embedded Marketo forms on your external website and tossing your other form.  It avoids duplicate work and gets the fields in Marketo where they (presumably) belong.

Bryant_Chang
Level 3

Re: External Webpage, external form, but want to pass back a form fill activity

Thanks Sanford!

Believe this is exactly what I was looking for. Will send this to my dev guy.

Reason we are not using a marketo form is because its a single field form (just email address) and want to have the button on the right of the field, which I couldn't get to work in the form builder. Is this possible in marketo?

Either way thanks for your response.

SanfordWhiteman
Level 10 - Community Moderator

Re: External Webpage, external form, but want to pass back a form fill activity

Sure, it's possible.  Probably needs a little custom CSS is all.  And for something so simple it's a pity to have to use an external form for it.  In fact, I'm not sure if you're aware of this, but if you post the Marketo form with the user's email address the lead's web activities will be tracked, which is an important part of marketing automation.  if you use only an external form then an organic visit to your site will remain anonymous, even if it includes a form fillout. That's not so good.

What's the URL of your page?

Bryant_Chang
Level 3

Re: External Webpage, external form, but want to pass back a form fill activity

Can you explain what you mean by "post the Marketo form with the user's email address"?

Are you saying that the leads web's activities will be tracked prior to the form fill out only if it is a marketo form?

Having an external webpage and form will not track visits or formfills even with munchkin on it?

the external form has not gone live yet (QA stage).

SanfordWhiteman
Level 10 - Community Moderator

Re: External Webpage, external form, but want to pass back a form fill activity

I could (and should) write a blog post about the technical internals, but for now...

You have a standalone non-Marketo form that you're using to gather email address, first name, last name.  I'm assuming you have some reason that compels you to use that form as the displayed form instead of using an embedded Marketo form.  If you only hook the non-Marketo form's onSubmit and do a hidden form post using the exact code I suggested above -- the least possible dev effort --  then while you will successfully log the Filled Out Form activity to Marketo, that FoF will be associated with a named Marketo lead only if/once the Munchkin cookie has been separately associated with a lead (because you invoked Munchkin's associateLead or because the user followed a link from an email).

In contrast, if you go a step farther and don't just post the empty form, but instead fill in the value of the Email field (using the Forms 2.0 API form.setValues({Email : "bryantchang@example.com" }), then the hidden Marketo form post will on its own carry enough information for Marketo to associate the lead. Thus including the email is a far better choice if your developers understand how to transport field data from your standalone form into a variable that is used in the Marketo form post.  I don't know where they stand technically.  If I could see the form I could tell you exactly how to extract and transport the field value.  However I must again recommend using a Marketo form if you can make the switch.  It's so, so much easier.

Michael_Tucker1
Level 4

Re: External Webpage, external form, but want to pass back a form fill activity

Sanford Whiteman​​, can you confirm the syntax on the callback parameter on the LoadForm method on line 5 of your code. Is the "form.submit()" call supposed to be modified for the name of the form object on the external page?

Michael Tucker
SanfordWhiteman
Level 10 - Community Moderator

Re: External Webpage, external form, but want to pass back a form fill activity

Nope, the cb function doesn't need any customization. You just need to customize the instance URL, Munchkin ID, and form ID.