Re: Cookie hidden fields don't work if custom html is used for known visitors

Nick_Deboo1
Level 2

Hi

I have lot of embedded forms on non-Marketo pages and I would like to make it easier for the visitor to e.g. fill in a webinar forms or ebook download forms.

Idea 1: pre-fill known fields

This doesn't work as the pre-fill unfortunately doesn't work with embedded forms on non-Marketo pages.

Idea 2: "If Known Visitor, Show:" custom html

This does work with embedded forms but the problem is that hidden fields don't take my cookie values.

Anyone other ideas? Transferring the content to Marketo landing pages is a no

33 REPLIES 33
SanfordWhiteman
Level 10 - Community Moderator

Sure, Boone, you can use the same JS with any Marketo form, whether on a Marketo LP or on another site.

On a Marketo LP, you would include the formsplus-util.js <script>, then the custom JS in another <script>, right before the closing </body> tag.

Boone_White1
Level 2

Okay I think I have my mind wrapped around this.

Just to confirm. I am on the right track. Should I make unique properties for each field and related UTM parameter?

See this example for UTM medium:

Screen Shot 2018-03-29 at 1.13.33 PM.png

Thank you so much Sanford, This has been extremely helpful.

Boone

SanfordWhiteman
Level 10 - Community Moderator

That's right. The property name in the hiddenFieldMap is the Marketo field name. The property value is an object that describes how/from where the field will be filled.

Boone_White1
Level 2

Great, so I will make unique ones for each.

And query would always be the right channel for that yea?

SanfordWhiteman
Level 10 - Community Moderator

Right, query = query param.

I have a newer version to publish soon that allows some more channels (like Referrer URL param, which I left off this quick CodePen the other day) and also allows for a "cascade" of channels, i.e. get from such-and-such cookie if exists, otherwise get from such-and-such query param, otherwise look for this other query param... extremely useful. I don't think I'll ever go back to the built-in hidden field AutoFill.

Boone_White1
Level 2

Sorry I deleted my prior responses.

For the HTML bit Do I need to paste the whole bit and update all the info to my form/instance details? or do I just need a piece from that code?

Thank you!

Boone

SanfordWhiteman
Level 10 - Community Moderator

You just need the teknklFormsPlus-0.2.0-Util include <script> and the code from the JS pane in another <script>. The other stuff is just there to have the demo load an actual form.

Boone_White1
Level 2

Awesome, that makes total sense!

Does this looked like it was installed correctly? I wasn't getting UTM results pulled-in. I figure i have it installed wrong.

Screen Shot 2018-03-30 at 3.27.57 PM.png

SanfordWhiteman
Level 10 - Community Moderator

Can you provide your URL please?

Boone_White1
Level 2
SanfordWhiteman
Level 10 - Community Moderator

If you look in your browser's F12 Console you'll see this 412 error on formsplus-util:

pastedImage_1.png

That's 'cuz you have to download the JS file onto your own server and serve it from there. It's for your own protection -- I can't afford to run a CDN for everyone who might use the file!

Boone_White1
Level 2

My bad lol. That makes sense the script works great!

Thank you so much!

Boone White

Grégoire_Miche2
Level 10

Hi Nick,

Log ideas rather than questions . People can vote and they are reviewed by Product Management.

Idea 1: pre-fill known fields

There are a lot of discussions and ideas already in the community on this. To make it short, there are good data security reasons for not doing this as someone could use your JS code to steal your data.

Idea 2: "If Known Visitor, Show:" custom html

Worth and idea so that we can vote for. Can be worked around with javascript, though.

-Greg