How to insert dynamic variables

https://preview.webflow.com/preview/healthyaccess-6a7862c33a0-eb2d94d58b78d?utm_medium=preview_link&utm_source=designer&utm_content=healthyaccess-6a7862c33a0-eb2d94d58b78d&preview=bfcfd0a5b269866e8267e831b1b2b37f&mode=preview

We are directing affiliate traffic to a landing page using a tracking link generated through LeadsPedia. Each time a lead clicks on the tracking link they are brought to the home page of the landing page and assigned a unique ID listed in the URL as lp_request_id=. After the = there are a seires of numbers, ie, their unique ID.

The lead then navigates to the call to action button and clicks through to another page where an Impressure form is embedded on. At this point, the unique ID is lost. I was provided this script to include in the code which will capture the ID however it’s not complete. There is no way to insert the dynamic variable (aka the id.)

Any ideas on how to handle this situaiton?

Please note I’m not a developer, so if you choose to respond, please be as detailed as possible and use lamens terms.

I’m guessing you’re getting the ID from the URL and store it in a variable with Javascript?

Then you can save it in the browser’s local storage like:

localStorage.setItem('ID', yourIDVariable);

This will store the ID locally in the browser, which you can retrieve in a variable on the next page like:

let user_ID = localStorage.getItem('ID')

Alternatively you could append the ID to the link of the button that sends the user to the next page, but I’m a bit too tired to write out that alternative right now.

In order to send the ID through with the form you would probably need to use a hidden field (which Webflow hasn’t added natively yet for some reason) which you then can pass the data from your variable to like:

  1. Give the hidden field an id

  2. Set the hidden field’s value to the user_ID variable

document.getElementById('yourFieldID').value = user_ID;