Using Javascript to capture URL params on Landingi


If you'd like to capture values from the URL and have them pass as a hidden field through with your Lead data, then this article should help you out.

This may be useful if multiple suppliers are directing traffic to your landing page and you'd like to track which leads came from which supplier.


Landingi Setup

Firstly, head to your landing page dashboard and click "JavaScript code".

Next, click add script and copy the JavaScript we've provided further down this article into the "content" box, have the Position as "Body bottom" and the Page as "Main page" - 



Finally, it's a case of creating hidden form fields to collect the values you pass through in the URL and mapping these fields to post to your LeadByte campaign.

The example linked in the previous sentence has hidden fields for SID, SSID, Source and C1. So if ANY of these values are submitted in the URL they will be captured and stored against the lead data.



var urlParam = getUrlVars();

for (var prop in urlParam) {
if (urlParam.hasOwnProperty(prop)) {
var input = document.querySelector('[name="' + prop + '"]');

if (input) {
if (input.type === 'checkbox' && urlParam[prop] === '1') {
input.checked = true;
} else {
input.value = urlParam[prop];




My example form URL is

I want to pass this to all my suppliers but have each suppliers traffic tracked.

Using the example format shown above, I'd simply need to add ?sid=123 into the URL

e.g. -

The JavaScript will capture the sid from the URL, store it against the rest of the lead information and pass it to LeadByte when the form is submitted.


As always, if you have any questions or concerns please raise a support ticket.

Was this article helpful?
0 out of 0 found this helpful