Page URLs from Salesforce Lead Form Submit  

Which Form or Web Page did a Salesforce lead come from?

Forms are one of the most essential parts of any website, providing a convenient way for visitors to “raise their hands” and request more information or take advantage of an offer. Web forms are also a critical way for your company to learn more about who is on your website, receive and qualify leads, and hopefully start your visitors on their buyer’s journey.


When you have multiple contact forms, tens or even hundreds of landing pages, and different paths visitors take on your web site, it can be difficult to keep track of which form a Salesforce lead came in through. Most forms are used with a specific conversion path, so in order to analyze your marketing results and most effectively connect with your leads, you need to know what that path was.


  • Know what page a lead came from
  • Understand where in the buyer journey your lead is
  • Track which offers or downloads prospects responded to
  • Score your MQLs more effectively with precise source data


So how can you know which form on your web site a lead filled out? Read on to learn about multiple different methods you can use to get this important marketing data.


Topics in this article:




Hidden Lead Source in Forms

If you are using Salesforce web-to-lead forms, or other forms like Gravity Forms or FormAssembly that can post leads into Salesforce, adding a hidden Lead Source field to your forms is one of the easiest ways of identifying them.

This method hard-codes a hidden field with a lead source value that you set for each form, and pushes that value to the existing Lead Source field on the Lead object in Salesforce.

Here is an example from a Salesforce web-to-lead form:

<input type="hidden" name="lead_source" value="LP Trial Offer">


Pro-tip: Use a common naming convention in your lead source values, such as “LP” for landing page, to make reporting in Salesforce easier (Lead Source *Contains* LP will collect them all).

  Filter by Lead Source - Contains - LP 

Another advantage of using hidden fields in this manner is that you can insert Lead Sources into your Salesforce leads that are not actually selectable values in the Lead Source drop down list. Salesforce will insert any value in the Lead Source field when the lead is created.

This approach means that you can be sure those lead sources are only coming from your form, since the value is not available to Salesforce users to select. No more random selections from the Sales team (not that your sales team would ever do that!)

On the minus side, there are some limitations to reporting if a Lead Source value is not added to the picklist values in Salesforce — namely you won’t be able to filter on those values by selecting one or more of them in a report. But you can still use “Starts with” or “Contains” to include any values.

Filter by Lead Source - Select - Lead Sources



Automatic Campaign Assignment for Leads

Similarly to using a hidden field in your forms to set a Lead Source in Salesforce, you can also automatically have leads added to a Salesforce Campaign using a similar method.

By adding a hidden field that passes the Campaign ID, your forms will automatically make leads members of that particular Campaign when they are created in Salesforce.

This technique is especially useful for forms or landing pages that are specific to a particular marketing campaign, since Salesforce Campaigns allow you to track members of a campaign from Leads through to conversion to Contacts, and see the ROI summarized clearly via Opportunities.


Here is an example of hard coding the Campaign ID in a hidden field in a Salesforce web-to-lead form.

<input type="hidden" name="Campaign_ID" value="7010V000001ufMIQAY">


To get the Campaign ID value for your hidden field, simply navigate to the Campaign Record in Salesforce, and copy the 18 digit record ID from the Salesforce URL in your web browser. 

Finding the Salesforce Campaign ID

Having leads automatically assigned to a Salesforce Campaign can be useful for other purposes as well, such as segmentation. If you want to compare leads that come in from a “Contact Us” form on your web site in total versus advertising landing pages, having them all assigned to a “Contact Us Form Campaign” makes it easier.

There are other advantages of assigning Salesforce Leads to Campaigns automatically, such as the ability to send Emails to campaign members in Salesforce (both Leads and Contacts at the same time, as long as they are members of the Campaign), as well as tracking any Opportunities that were generated from Campaign members.



Custom Salesforce Fields in Forms

Custom fields are one of the more powerful features of Salesforce that most organizations take advantage of to capture unique business data.

Just like the hidden Lead Source and Campaign ID fields shown above, you can add Custom fields from Salesforce to your forms to better identify them.

In most cases these custom Salesforce fields would be hidden, transmitting their values in the background when a form is submitted, but in some cases you could make them visible to visitors (such as in a quote form where the lead might choose a value from a picklist, that might also enable you to identify the source form).


Here is a high level overview of how to create a custom field in Salesforce (you will need to be a Salesforce Administrator or have “Customize Application” permissions:

  1. Go to Setup
  2. From the Object Manager, select the Lead object
  3. Select Fields & Relationships
  4. Click the New button


There are quite a few considerations and configuration options at that point, so please refer to Salesforce’s custom field documentation for full details.

Salesforce Custom Field Addition in Object Manager


Once you have created a custom field, you will need to add it to your form. For Salesforce web-to-lead forms, you can generate updated code from the setup page after including the new field.

For other form providers, you will likely need to refresh the connection to Salesforce, to have the new custom field available in the mapping / form setup interface.



Using a Single Form on Multiple Pages

If you are using the same form on multiple pages, which is especially common if that form is being dynamically embedded using a script or iFrame on your web site, things get a lot harder. 

Forms that are embedded, rather than having their full HTML code as part of the web page, are an increasingly popular option. They allow marketers a greater degree of control, with a single embed tag added to your web site, and a separate form software interface where you can configure your form and simply click a button to publish a new version.


Many embedded forms offer a way of getting the page URL, and making it part of the form submission. With a single form across many web pages, it has become essential for some unique identifier to be captured with the form submit.

Otherwise you have no way of knowing where your submissions are coming from when the same form is embedded in many web pages.


Here is an example of a useful widget that the form provider JotForm makes available to its customers:

Get Form Page URL Widget

Check with your form provider to see if any hidden fields or widgets exist to give you some insights on where your customers are filling out your forms.


Using a single form across multiple pages of your web site does make setting up and maintaining lead generation forms simpler (especially if you have 25+ landing pages with forms, as is common for many businesses that market online).

However, if you have the option from a form technology perspective, working with your web developer to duplicate and customize your forms individually can provide automation advantages on the lead qualification side (such as auto-assigning to Salesforce Campaigns or Lead Sources described above).

You’ll just need to keep an organized spreadsheet of your landing and form pages, and make sure your web developer is careful and understands the importance of updating the values when creating new forms.



Form ID and Name

Many forms have an ID and/or Name in their code, which helps identify them as your web page loads. These form attributes are also referenced by apps like the CloudAmp Campaign Tracker, which uses the IDs to tell our tracking script where to insert marketing attribution data.


To find the form ID, follow these steps.

  1. Load the web page with your form
  2. Right click on the form and select Inspect Element
  3. Type Ctrl + F to bring up the search (find) box.
  4. Enter <form to find the beginning of a form in the code


Some forms have an ID, and some have a name. Most forms have both, but either can be used to identify the individual form. 

Once you have identified the attributes, the tricky part is determining if they can be passed to Salesforce in some way. Your web developer may be able to use the form ID to capture the form source information when a visitor clicks to submit the form, and pass it to Salesforce along with the other fields.


Here is an example of a form ID in the initial Form tag, from Gravity Forms:

<form method="post" enctype="multipart/form-data" target="gform_ajax_frame_1" id="gform_1" action="/contact-us/#gf_1" data-formid="1" novalidate="">


Note: Salesforce web-to-lead forms do not have IDs or Names, but define a separate hidden field for the Salesforce Org ID, named OID.



UTM or other URL Parameters

This solution is not part of the form itself, but if you are capturing parameters from an incoming link to your website, you may be able to use those to identify the form.


As an example of what we mean by parameters would be a URL such as:{Keyword}


The parameters are in green text, and their sample values are shown in red text. The ? in the URL defines when the web address ends and the optional parameters start, and the & characters separate the different parameters.


Some of the most common parameters are known as the UTM or Google Analytics Campaign parameters:

  • utm_id: Campaign ID.
  • utm_source: Referrer to your website, for example: facebook, google
  • utm_medium: Marketing medium, for example: PPC, email newsletter
  • utm_campaign: Marketing campaign name or identifier (product, dates, etc.)
  • utm_term: Paid keyword, commonly from Google Ads or Bing
  • utm_content: More information about the marketing creative, ad text, etc.

Your web developer may know how to write javascript to capture parameters in the URLs that visitors click through to get to your website, or you can use a Salesforce app like CloudAmp’s Campaign Tracker to capture the data and make it part of your Salesforce leads.


This approach assumes that you have landing pages that are only receiving traffic from certain campaigns. It will not work with generic Contact Us pages or similar forms, where visitors from many different sources might be arriving there.

You can also use utm values to define source data (utm_campaign=LandingPageOffer1), and if you make it unique to a particular landing page, tie that back in your tracking (be sure to keep a careful UTM values spreadsheet in that case!)



Salesforce Visitor Sessions (List of Pages Visited)

Some tools like CloudAmp’s Campaign Tracker will show you a complete list of pages that your lead visited on your web site, prior to filling out a lead form. You can often see multiple visits (sessions) as well.

In the CloudAmp app, this data is provided in the “Visitor Sessions” object in Salesforce, which is related to the Lead (and later the Contact after conversion).


Here is an example lead, with the Visitor Sessions related list in the right hand column, showing the pages viewed by the Salesforce lead before they submitted a form.

 Salesforce Lead with Visitor Sessions Related List 

As you can see from this simple example, the lead landed on a Setup page, and then went to the Contact page, which is where they submitted the form.


You can click “View All” to see the full related list, where you can more easily see the page titles and complete URLs, as well as the time stamps from when a visitor was on each one of your web pages.

Salesforce Visitor Sessions list with Web Pages Shown

If a lead visits your web site multiple times before submitting a form, that is shown in the data as well. Each session (visit) is numbered to tell them apart and give you visibility into which web pages the Salesforce lead viewed.

Salesforce Visitor Sessions list with Web Pages Shown and Session Numbers



We’ve reviewed seven (7!) different ways to know what web page form a Salesforce lead came in through. There are likely other methods as well, but one or more of these should give you a good starting point to capturing better marketing data in Salesforce. 

If you have questions or feedback about the approaches described above, don’t hesitate to contact us. (Comments are turned off here to prevent spam, but we’re always happy to talk shop via email).


Learn more about CloudAmp

If you want to have more data about your Leads in Salesforce, including full source attribution and page view data to prove ROI and improve your marketing, contact us for more information today.




Spread the love