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!
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:
console.log( ga.getByName('gtm1').b.data.keys );
You can get a field's value using the same syntax as above:
I don't know what you're trying (you should add what isn't working for you) but the query param is uid.
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?
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.
Wow - thank you very much! I have a test form at the following URL.
I went to this URL:
The hidden field is being filled correctly and sent to Marketo (check for the email address email@example.com):
So I suspect something is up with your tests.
There are also two JS syntax errors on the page. These aren't causing the problem (they are contained within their own SCRIPT tags) but make troubleshooting more confusing.
Which you do like this:
GA_User_ID__c : ga.getByName('gtm1').get('userId')
Note you don't need the field added to the form (in Form Editor) at all since you're doing it this way.
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.
We pull in URL data into a hidden field on a form like in the picture below.
Retrieving data ...