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 
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 - Infusionsoft Google Analytics Ecommerce Tracking - Start Smart Now.
The challenge is that Infusionsoftâs lead source field isnât a standard form field that you can easily populate with JavaScript like you would with name or email fields. Itâs more of a system field that gets set through Infusionsoftâs internal processes.
You have a couple of options here:
The simplest approach is to create a custom field in Infusionsoft (like âMarketing Sourceâ or âCampaign Sourceâ) and use that instead of the built-in lead source field. Custom fields behave like normal form fields, so your JavaScript approach of pulling the UTM parameter and setting the field value should work perfectly.
Alternatively, there are tools like Attributer that can handle this automatically for you (disclosure: I am the founder). It captures UTM parameters when visitors first land on your site, stores them in a cookie, and then writes them into hidden fields on your Infusionsoft forms when theyâre submitted. So someone could click your Facebook ad, browse around your site, and when they eventually submit the form it would still capture âFBAdâ from the original utm_source parameter.
As a bonus, it also captures data on leads that come from organic channels (like Organic Search, Organic Social, Direct Traffic, etc.) where you donât have UTM parameters, plus things like the GCLID for Google Ads conversion tracking.
Yeah, Infusionsoftâs hosted forms donât generate standard HTML IDs for their lead source field like they do for other fields, which makes it tricky to populate via JavaScript.
You have a few options here:
The easiest approach is to use tools like Attributer that handle this automatically. It captures the UTM parameters (plus other attribution data like organic search, direct traffic, etc.) when someone first lands on your site, stores them in a cookie, and then writes them into the lead source field when they submit your Infusionsoft form. So someone could click your Facebook ad, browse around your site, and when they eventually convert the lead source would still be captured as âPaid Socialâ with the campaign details.
You could also try to write custom JavaScript to find the lead source field by its name attribute rather than ID, but Infusionsoftâs form structure can be inconsistent and this approach often breaks when they update their form rendering.
The other benefit of using a dedicated tool is that it categorizes your traffic properly. So your Facebook ads would show up as âPaid Socialâ rather than just âFBAdâ, and youâd also capture leads from organic channels that donât have UTM parameters (like people who Google your company name and convert).
You could certainly try to bridge this with custom code, but maintaining that script as Infusionsoft updates their forms and as browsers change behavior can be quite time-consuming.