Back to Top

How to use Salesforce Web-to-Lead In Magento2

Updated 8 February 2024

Salesforce lets you can easily create web-to-lead forms that capture information about visitors to your website. The information is automatically stored in new lead records in your Salesforce install, and the lead can then be scored, qualified, and routed to sales reps.

From there, you can redirect visitors to other pages on your site, send automated email follow-ups, and start them on customer journeys.
Here we can generate a lead in Salesforce using Magento 2 form builder.


The process of using a website form to capture visitor information and store that information as a new lead in Salesforce.

Available in: Group, Professional, Enterprise, Performance, Unlimited, and Developer Editions

Create Web-To-Lead Form

  • Open your Salesforce Org. Login URL:
  • Go To Setup -> Quick Find and enter web-to-lead.
  • Click on the web-to-lead link.
web to lead home
web-to-lead main page
  • Add/Remove fields between “selected fields” and “Available fields”. Selected fields will be displayed in the Magento2 site.
  • Return URL: The page will redirect to this after submitting the form from magento2.
  • Include reCAPTCHA in HTML: This is optional, checked it if you want to display ReCaptcha with this form.
  • Click on the generate button to generate Form.
web-to-lead configuration
  • Copy the HTML code to add the form on your website & click on the “Finished” button.
web-to-lead setup

We have Successfully created a Web-to-Lead Form, Now we will learn here, How we will use this copied HTML code in our Magento Store to collect leads in my Salesforce Org.

Searching for an experienced
Magento Company ?
Find out More

Use HTML code on the Magento2 to collect leads

  • Open the admin panel of your Magento2 store.
  • We need to create a block to use this copied script in the Magento2 store.
  • Go To Content -> blocks to “add new block”.
magento add block
  • Enable the Block.
  • Fill the Block title and identifier.
  • Paste the copied HTML code in the Content Editor.
  • Remove extra comment & meta tag from HTML script.
magento content editor

NOTE: Your editor must have enabled WYSIWYG to render HTML code.

Enable WYSIWYG Editor : Goto Store -> Configuration -> Content Management

magento editor setting

Add Block In Menu of Magento2 Store

  • Go to the Catalog -> Categories -> add Subcategories
magento subcategory
  • Add new Subcategory .
  • Enable Category and include in Menu to “Yes”.
  • Fill the Title.
magento2 add subcategory
  • Expend the content section.
  • Select the recently created block in “Add CMS Block “.
magento create block
  • Set Display Mode to “Static Block Only” in the display setting section.
  • Save the category.
display mode
  • Now the menu item is ready to access from the store front end and it will look like this
  • You can customize CSS via inline CSS.
web to lead form

A new lead will be generated in salesforce org whenever this form will be filled and submitted by the customer,

customer filled web to form

The lead will look like this

lead at salesforce

Note: You can also sync your Magento (product, category, customer and order) to your salesforce org.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home