Get Data form Browsers Local Storage [RESOLVED]

I would like to know, if there is a way to gain data from the Local Storage of the Browser and write it into a hidden field?

Some background info:
We are getting Affiliate Traffic with URL Parameters (eg: domain.com/?partnerid=123)
At the moment, we are writing the values of our parameters in hidden fields to track the leads.

Problem starts, when users are clicking to other URLs on our domain, returning to the form and filling it out. In that moment we lost the URL Parameters and so we are not able to track this leads.

Now we have managed to write the parameters into the local storage of the browser. So we need a solution to write them into the hidden fields, if that´s even possible.

Thanks and best regards

Hi Mario. If you have the data stored in local storage, you can retrieve it via JavaScript and populate the fields in the form. There are no methods in Gravity Forms that can do that, but you can add your own custom JavaScript to the form, by pasting that into an HTML field you add to the form.

Here is a discussion I found about retrieving the data from local storage:

Then, to populate fields in the form using JavaScript, you can do this:

jQuery("#field_id").val('Custom value here');

The val would come from what you retrieved from local storage.

1 Like

That´s exactly what i was hoping for. Thanks a lot!

1 Like