How do I set the hidden Leadsource field based on URL param in Infusionsoft form?

We want to host the IS form on our site. We also want to use the same form for multiple channels like PPC, FB etc. The links to our pages will include the source (for example we could use utm_source =FBAd).
I want to extract the lead source value from the URL param and set the Leadsource value when the user submits the form. So I tried creating a form with the Leadsource as a hidden field. However, when I use the HMTL code (unformatted), I see the hidden field but it does not have the id associated with the Leadsource field. Other fields like name and email have the id so I can set the value by using the Java script code document.getElementById(‘inf_field_FieldName’).value = getUrlParameter(‘utm_source’);

I am not a Java script expert so I am assuming there is another way to accomplish this. Hopefully, I am not the only one attempting to do something like this.

Email *

So we’re talking about the webform widget and not the landing page widget?

You can take the leadsource tracking code in your ecommerce setup and place it into the webform in a script tag.

Hi John,

Thanks for your response.
That’s right we are talking about the webform widget.
What if I want to set the Leadsource value based on a specific url param whose value is set to a Leadsource we have created in IS? For example, we have paid search (id=1021) and I want that id to be passed in the URL param so we attribute the form submission to that specific channel. Would that still work if I do what you suggested.

Thanks

Devaraj

To do that would take some coding. It would require grabbing the code from the url, passing it along to a middle ware script that would then update with the correct leadsource and then forwarding to a thank you page. The user doesn’t notice any of this but it’s a common process for updating information that isn’t inherently available out of the box, which, selective leadsource through the url is not :wink:

Yep. Got it. I was able to make it work. I had to tweak the Java script a little bit. Thanks for your help.

1 Like

I use a third-party tool that helps us track the traffic source for all lead and ecommerce transactions using Keap optin forms hosted on our site or order forms. More info here - https://startsmartnow.com/infusionsoft-google-analytics-ecommerce-tracking/.