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 will generate a lead in Salesforce from magento2 using web-to-lead 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: https://login.salesforce.com
- Go To Setup -> Quick Find and enter web-to-lead.
- Click on the web-to-lead link.
- Click on Create “Web-to-Lead Form” to create the form.
- To edit form settings, add template & reCAPTCHA, You can follow this link: https://help.salesforce.com/articleView?id=setting_up_web-to-lead.htm&type=5
- 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.
- Copy the HTML code to add the form on your website & click on the “Finished” button.
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.
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”.
- 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.
NOTE: Your editor must have enabled WYSIWYG to render HTML code.
Enable WYSIWYG Editor : Goto Store -> Configuration -> Content Management
Add Block In Menu of Magento2 Store
- Go to the Catalog -> Categories -> add Subcategories
- Add new Subcategory .
- Enable Category and include in Menu to “Yes”.
- Fill the Title.
- Expend the content section.
- Select the recently created block in “Add CMS Block “.
- Set Display Mode to “Static Block Only” in the display setting section.
- Save the category.
- 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.
A new lead will be generated in salesforce org whenever this form will be filled and submitted by the customer,
The lead will look like this
Note: You can also sync your Magento (product, category, customer and order) to your salesforce org.