2 Replies Latest reply on Aug 13, 2015 8:23 AM by 5ff57d4891e46c30824df12e3950b8ce5da205ce

    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

        • Re: Forms 2.0 .getPageFields()
          Sanford Whiteman

          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.

          1 of 1 people found this helpful