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.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.