SOLVED

Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

Go to solution
Highlighted
Level 1

Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

I am using persistent cookie tracking to capture first touch/last touch source info via hidden fields on our Marketo form. But I'm looking to capture the referral URL for return users. So if we've already captured them as a lead but they return to our site after clicking on an ad, I want to be able to capture that touch point. The only way i know how to pass the data from cookie to Marketo record is a form. Can I pass it without having to rely on the form?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

You can have the fields (both the Hidden fields w/AutoFill and the normally visible ones) on the form in Form Editor. As you said, this is the only way to get the automatic query param pickup so you don't need to rewrite using JS.

View solution in original post

7 REPLIES 7
Highlighted
Level 10 - Community Moderator

Re: Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

There used to be, but not anymore. You can use a hidden form, however — the only drawback is it creates a Filled Out Form activity, so name your form something that won't be confused with a user-facing form (like "Background form for attribution tracking").

Highlighted
Level 1

Re: Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

Thanks, @SanfordWhiteman. So if I use the following discussion as a start, I would create a form with only hidden fields, then copy the form code (adding the suggested style="display:none" to the form id) and place on the index page of the site? Or is that going to bog down my site speed if it tries to pass data (form submit) every time the user clicks to a new page on the site?

 

I want to be able to capture the data regardless of the landing page but obviously it's not ideal if a user's activity shows 10 form submissions just from clicking around or if it jeopardizes speed/data flow. Maybe code to tell it only submit once per session? But I'm not a developer and wouldn't know where to start with that.

 

https://developers.marketo.com/blog/make-a-marketo-form-submission-in-the-background/

Highlighted
Level 10 - Community Moderator

Re: Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

Well, the form submission itself is always asynchronous.

 

Injecting the form itself can also be async, if you ensure the Forms 2.0 library (forms2.min.js) is loaded async. This'll mean it won't slow down other parts of the page at all, but also means in theory the form may not have a chance to submit before the person navigates away. C'est la vie!

 

However, I'm concerned about what you're trying to do here with this much form/update activity. Yes, you can have it submit only once per session — it should already only submit when there are newly interesting attribution values, anyway. No reason to submit on every page, Munchkin is already doing that.

 

Highlighted
Level 1

Re: Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

Makes sense. So with the submission code below, it would capture/pass a new user's info. But if they click around, it's only going to pass if info in the selected attributes are new.

 

var myForm = MktoForms2.allForms()[0];
myForm.addHiddenFields({
//These are the values which will be submitted to Marketo
"Email":"test@example.com",
"FirstName":"John",
"LastName":"Doe"
});
myForm.submit();

 

And sorry, one last question. In the example I keep referencing, it says to keep the form empty and just list the fields in the embed code that I want to pass. But I'm reliant on the field setup so I can pass cookie values. Can I set the form up as I normally would with hidden fields (but not empty)? Or do I need to write something similar to your JS snippet here: https://codepen.io/figureone/pen/aazEPW 

 

 
Highlighted
Level 10 - Community Moderator

Re: Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

You can have the fields (both the Hidden fields w/AutoFill and the normally visible ones) on the form in Form Editor. As you said, this is the only way to get the automatic query param pickup so you don't need to rewrite using JS.

View solution in original post

Highlighted
Level 1

Re: Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

Thank you!

Highlighted
Level 7

Re: Pass Cookied Values to Marketo Without Using a Form w/ Hidden Fields

Yes it's a shame that munchkin associate lead will be deprecated. I hope they replace it with something similar.

As for non-form solutions, If you have a CDP, like Tealium, in your stack, that would be the ideal solution. Push the value to the CDP then sync the data across to Marketo.