Does anyone know how to pull a User ID into a hidden field? | Community
Skip to main content
February 14, 2017
Solved

Does anyone know how to pull a User ID into a hidden field?

  • February 14, 2017
  • 2 replies
  • 5642 views

Hey Marketo Community! Does anyone know if or how I can pull this user ID into a hidden Marketo field? I've been trying to pull it in based on a cookie but no matter how I configure it it doesn't seem to work!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

I can't thank you enough, Sanford! I have it pulling in the proper information. I had one last question if you have any insights on the matter.

I started pulling additional insights from the Google Cookie and I was wondering if you knew how to add that to my Marketo forms, whether that is through an automated process like the one you shared above, or through hidden fields.

2017-02-15_1602 - Michael_Patterson's library 

Thank you again, so much.


Not all of those field values can be fetched from the Tracker object... this kind of "introspection" is not actually supported, AFAIK, it just happens to work for some well-known fields.

The (theoretically) full set of fields available you can see by running:

MktoForms2.whenReady(function(form){

  ga(function(){

    console.log( ga.getByName('gtm1').b.data.keys );

  });

}); 

You can get a field's value using the same syntax as above:

ga.getByName('gtm1').get('flashVersion');

ga.getByName('gtm1').get('screenResolution');

// etc.

Note that adding hidden fields via the Forms 2.0 API + JavaScript is still using hidden fields. The result on the form, and on the Marketo side, is exactly the same as if you added them in Form Editor. The difference is that when adding fields in FE, you get to choose sources like Cookie, Current Query Param, or Referrer Query Param -- but only those sources.  While when you add the field programmatically, you don't get the automatic ability to draw from those common sources (you can simulate it yourself, though) but you do get the ability to draw from any source available in the browser.

2 replies

February 14, 2017

Hi Michael,

We pull in URL data into a hidden field on a form like in the picture below.

SanfordWhiteman
New Participant
February 14, 2017

I don't know what you're trying (you should add what isn't working for you) but the query param is uid.

Hence:

February 14, 2017

Thanks so much for the response, Sanford! I apologize for being unclear.

Ideally I can start pulling those query parameters into hidden form fields so when a user submits a form I will be able to push that additional data into Marketo. I've tried setting my hidden fields similar to yours above, but unfortunately that doesn't seem to be pulling in the data. Has that worked for you?

Best,

SanfordWhiteman
New Participant
February 14, 2017

There's no known bug in this area.

If you post a link to a page with your form, I can tell you quickly if it's working and posting data.