Send lead source data to Salesforce

Prerequisite:
đź”—Add the Leadsources script to your website
đź”—Add hidden fields to your form

We collect leads and their source information (channel, source, campaign, term, content, landing page, and subfolder) using our form.

Our goal is to send this data to Salesforce, so we can track which leads turn into customers and identify the channels, sources, campaigns, etc. driving sales.

This allows you to focus your marketing budget on what works and eliminate what doesn’t.

We are going to use Zapier to send your leads and their source data to Salesforce.

The process has 4 steps:

  1. Create custom fields in Salesforce to store the lead source data
  2. Display the custom fields in Salesforce
  3. Set up Zapier to send new leads (and their source data) from your form to Salesforce
  4. Test the automation

Step 1: Create the custom fields in Salesforce #

What is a custom field in Salesforce?
To store lead source data for each lead in Salesforce, we need to create custom fields. In Salesforce, custom fields are used to store details about your leads (address, name, company, etc.).

By creating new custom fields, we will allow Salesforce to store the lead source data for each lead: channel, source, campaign, term, content, landing page, and landing page subfolder.

Log in your Salesforce account –> Click the Leads tab –> Open any lead.

On the top right corner, click the Setup gear icon –> Click Edit Object.

From the left panel, select Fields & Relationships. On the main panel, click New.

The New Custom Field window opens. Let’s create the Channel custom field:

Scroll down and check the Text radio button –> Click Next

Enter the details:

  • Field Label=Channel
  • Length=255
  • Field name=Channel
  • Leave the rest as it is, click Next

Select the profiles to which you want to grant edit access to this field –> Click Next

Make sure the Lead Layout is checked –> Click Save & New

    You have now created the Channel field. Use the same process to create the rest of the fields below:

    Data TypeField LabelLength
    TextSource255
    TextCampaign255
    TextTerm255
    TextContent255
    TextLanding page255
    TextLanding page subfolder255

    You have now created all the custom fields that will store the lead source data.

    Now we want to display them from the Lead view.

    Step 2: Display the custom fields in Salesforce #

    To make the new fields visible from a Lead view, let’s go through the following steps.

    Head back to the homepage –> Leads –> Open any lead

    Click the Setup gear icon –> Edit Page.

    We will display the custom fields in the Highlights Panel.

    Select the Highlights Panel. From the right panel, click Leads Custom Compact Layout (previewed).

    The Lead Compact Layouts page opens –> Click Edit.

    In the Select Compact Layout Fields section, select the custom fields you want to display –> Click the Add arrow.

    Repeat until you have added all the following fields:

    • Channel
    • Source
    • Campaign
    • Term
    • Content
    • Landing page
    • Landing page subfolder

    Click Save.

    Head back to the homepage –> Leads –> Open a lead.

    From the Highlights Panel, click Edit.

    Scroll down until you find the custom fields displayed.

    The fields are currently empty. To populate them with the lead source data that Leadsources captured in your form, we are going to connect your form with Salesforce in the next step.

    Step 3: Send lead source data using Zapier #

    Zapier is a workflow automation tool that connects different apps. In our case, we’ll create this workflow:

    When a lead is captured in our form ➡️ Create Lead in Salesforce

    Note: This workflow sends your new leads to Salesforce. If you’re already sending leads to Salesforce, make sure this method doesn’t create duplicates. Adjust the guide as needed to fit your process.

    Sign up to Zapier.com (it’s free).

    Create a new Zap.

    The Zap editor opens.

    Click in the Trigger box.

    Our trigger will be: a new lead is created in our form builder.

    In our case, we use Typeform to collect leads. But you can connect another form builder.

    Search for your form builder in the search bar. Select it.

    Set the Trigger event as “New entry” – wording can vary.

    Under Account, link your form builder account with Zapier.

    Click Continue.

    Under Form, select the form you want to connect.

    Click Continue â€“> Click Test Trigger â€“> Click Continue with selected record.

    The pop-up for the Action box opens.

    Here we are going to define the Action event you want to occur on Salesforce when a new lead is generated in our form builder.

    In our case, we want to Create Lead on Salesforce. Let’s go through the steps:

    Search for Salesforce. Select it.

    Under Action event, select Create Lead.

    Under Account, connect your Salesforce account with Zapier.

    Click Continue, the Configure section opens.

    Here, we want to map the fields between our form builder and Salesforce. Feel free to map the data you want to send to Salesforce by clicking the + symbol next to each field.

    Scroll down the Configure section until you find the custom fields we just created: channel, source, campaign, term, content, landing page, landing page subfolder.

    Let’s map the Channel field:

    1. In the Configure section, identify the Channel field
    2. Click the + icon
    3. Select the Channel hidden field from your form

    Let’s use the same process to map the rest of the fields (from Salesforce) with their associated hidden fields (from your form builder):

    • Source
    • Campaign
    • Term
    • Content
    • Landing page
    • Landing page subfolder

    Click Continue. You enter in the Test step. Click Test step.

    If the test is successful, a green check is added next to the Test title.

    Click Publish.

    You are all set!

    Step 4: Test the automation #

    To test the automation:

    1. Empty the cache of your browser
    2. Visit your website from the channel of your choice. You can use this link to emulate a Google Ads click:

    đź”— https://yoursite.com/landing-page?gclid=123456789&wc_clear=true&UTM_source=Google+Ads&UTM_campaign=Your+Campaign+Name&UTM_term=Keyword+Clicked&UTM_content=Ad+Name

    ➡️ Replace the italic URL with your landing page URL

    Fill out your form and submit it.

    Head back to Salesforce –> Leads page.

    If the automation was successful, you will see your new lead. Open it.

    In the Highlights Panel, click Edit.

    Scroll down until you find the 7 custom fields: channel, source, campaign, term, content, landing page, and landing page subfolder.

    The fields have been filled out with the lead source data captured by Leadsources (channel, source, campaign, term, content, landing page, and landing page subfolder).

    You can now track the source of each lead directly in Salesforce.

    When a lead turns into a customer, you can link this customer back to the channel, source, campaign, etc., that generated it.

    This allows you to adjust your marketing activities to focus on the channels, sources, campaigns, etc., that drive sales.

    What are your feelings