Forms 2.0 .getPageFields()

Anonymous
Not applicable

Forms 2.0 .getPageFields()

Hey everybody,

Does anyone successfully use the .getPageFields() forms2.0 method to get data?

I have been trying to fill the object with data but I feel like its always empty (printed in console) -

Object {cr: "", kw: "", q: ""}

I tried to refer from google and facebook but nothing seemed to pass through. Any thoughts?

Sanford Whiteman​ maybe you'll know

Tags (2)
2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Forms 2.0 .getPageFields()

cr and kw will populate from the current URL (on your site).  Does that not work for you?

Unfortunately, the line in MktoForms2::getPageFields to parse the referrer's query string is broken (it looks at the wrong part of the referrer URL), so you shouldn't expect q to work. 

Complicating matters:

  1. Not every referrer will be available to your page in the first place.  If your LP is http:// and the referrer is https://, JS can't see the referrer, so it can't parse it.
  2. Search engines don't want you to see the user's original q anymore.

For all the above reasons it's best practice to encode the source in the destination URL, that is, instead of expecting to see q=crazee in the referrer URL, put source=crazee in the destination URL.

Anonymous
Not applicable

Re: Forms 2.0 .getPageFields()

Yeah even the cr kw don't populate from https to https pages even though document.referrer was giving expected result.

It was actually just to see referrer internally but that wasnt working so I was trying other referrers Im not sure why I expected to see anything from google as they basically give nothing nowadays.

Thanks for your helpful input.