How to code LeadSource when form is built/hosted on website?

We’ve just done a complete redesign of our website, including changing the CMS.

The original site used WordPress, and the newsletter subscriber request form was built and stored here in InfusionSoft. The old website simply linked to it, as commonly done.

The new site has been built in Drupal. Because we could not get the above request form to match the look/format of the rest of the site, we chose to build the form within the site using the Drupal Webforms module.

So far, so good. It only needs the First Name (inf_field_FirstName) and Email address (inf_field_Email) fields. Also being passed back to InfusionSoft are the hidden fields inf_form_xid, inf_form_name and infusionsoft_version. New subscriber requests are being stored in the correct Web Form when checking the tracking reports.

The problem is, of course, that our website name no longer gets loaded in as the LeadSource. (Although the IP Address for these new entries matches our web address, so there is an indication there). The question is … how can we pass the LeadSource along when the form is submitted on our site?

Although we are not using the form itself within InfusionSoft, I did go ahead and put LeadSourceId as a hidden field in the form. Over on the Druapl side I added a new hidden field called inf_field_leadsourceid. For its value I did look up and put in the proper id number (in our case it is 1642). But still nothing appears in the Lead Source column when new forms are submitted and received.

What is the proper way to code Lead Source?

Also, as mentioned above, the IP Address that is being passed back to InfusionSoft is the address of the website itself and not the user, even though we are capturing the user’s IP address at our end and it shows in the Webforms database. How can we pass that proper value back as well?

Under your marketing menu, if you click Lead Generation,

Then under ‘Manage Tracking for Your Website’ click Get Tracking Code for Your Websites,

You will find the tracking link to embed on any page you wish to track leadsourcing for.


Thank you, but I don’t think we are talking about the same thing.

For starters, I get the impression (although I am still learning InfusionSoft) that these tracking codes are for use when the website is embedding the form that is produced and exists/is hosted within InfusionSoft.

We are not doing that. Our form exists entirely on our website. We are passing as keywords/data two visible fields and three hidden fields to InfustionSoft. It is recognizing and accepting this data, and is placing the First Name & Email Address within the correct web report/list. I don’t see how obtaining a tracking code can then be attached to the form to send that information back to InfusionSoft.

As mentioned above, we are already successfully passing back two visible and three hidden fields. We just need to add a 6th field (Lead Source ID) and possible a 7th field (user’s IP address) within the form. And the Lead Source simply needs to be the overall website URL - not the URL of each page - which already exists in our account as Lead ID # 1642.

If you already have the lead source created, and therefore have the ID, you can pass it in a hidden field with the name inf_field_LeadSourceId.

If you want to create lead sources on the fly, you can pass the name and category as inf_field_LeadSourceName and inf_field_LeadSourceCategoryName



Thanks for the additional idea. But as noted in my original post, I am already using the hidden field name inf_field_LeadSourceId but it is not being accepted at the InfusionSoft side. So my initial question was why?


Just to check. The leadsource id field is a number representing a leadsource that already exists within your app. So you’ve checked that the leadsource exists and that you have that id number set to inf_field_LeadsourceId, correct? Finally, LeadsourceId, I’m fairly certain, should not have a capitol ‘S’ (but rather lower case)


Yes, I definitely checked the existing leads. The ID number that corresponds to the web site URL in my InfusionSoft account is 1642. Which is what I am using to pass back in my form.

Regarding the case of the characters, should the variable name (ie, starting with inf_field_) match the name when designing the form? Because if you select the lead source id when building a form within InfusionSoft, it definitely has a capital ‘S’ there: LeadSourceId (I just checked to confirm).

NOTE: I’m going to play around with adding that field as a visible field, then look at the HTML generated to verify how the variable should be spelled.


Weird. I’ll make changes to the form and put visible fields in the form - like asking for company name - and making them required. But when I go to the “Code” tab and look at HTML or HTML unstyled, none of the new fields are reflected in the code. All I see are Email and First name, which have been the fields always there.

Why doesn’t looking at the code tab reflect form changes that are being made? The upper right portion of the screen shows “saved on” as the time I last made a change, so the new fields should be reflected.

Just to be clear, I am not looking to add new fields to the form here in InfusionSoft - just trying to see the internal variable names. Once HTML reflects the changes, I’ll add Lead Source to verify the cases used in its variable name.

Ok, the cap s part I wasn’t absolutely sure of. I mentioned it because that is not how it’s named in the data base table that us programmers use. As to viewing the code, are you sure you’re not viewing the frame (the internal form) as apposed to the whole document?


I’m in the “Design” tab of the form when placing new fields. Then I go to the “Code” tab and in the “Do it yourself” section look at the HTML Code (unstyled).

Since it shows two areas starting with div class=“infusion-field” that include the fields for First name and Email, and another section showing the Submit button and how it is labeled, I was expecting this to represent all of the fields on the form. So why when I add other visible fields - such as company name - and make them required do they not also show up in this code area?



Skipping the attempt of trying to use the existing Lead Source ID, I tried as you said and instead used inf_field_LeadSourceName, passing in the website URL. It worked, storing in the data exactly what I wanted.

1 Like

Is it not possible to pass in the ID of a pre created form in the inf_field_LeadSourceName?