{"id":106101,"date":"2012-12-24T09:00:31","date_gmt":"2012-12-24T14:00:31","guid":{"rendered":"http:\/\/wpmu.org\/?p=106101"},"modified":"2016-03-31T01:46:58","modified_gmt":"2016-03-31T05:46:58","slug":"turn-your-wordpress-website-into-a-lead-generating-machine","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/turn-your-wordpress-website-into-a-lead-generating-machine\/","title":{"rendered":"Turn Your WordPress Website Into a Lead Generating Machine"},"content":{"rendered":"<p>Your fantastic website runs on WordPress and your CRM of choice is Salesforce, but you just can\u2019t seem to get the two applications to play nice together.<\/p>\n<p>Fret no more, in this daily tip we\u2019re going to show you how to integrate WordPress and Salesforce, and turn your website into a lead generating machine!<\/p>\n<p>A note before we start: We\u2019ll be using the <strong><em>Web-to-Lead<\/em><\/strong> feature of Salesforce, which requires you to be using their Group Edition platform, or higher.<br \/>\n&nbsp;<\/p>\n<h2>Why Integrate WordPress with Salesforce?<\/h2>\n<p>The benefits of using a CRM to track potential leads and customers are numerous &#8211; too numerous to list in this article, but it is safe to say that businesses which track and analyze sales perform much better than businesses which do not.<\/p>\n<p>There are a few plugins out there which connect the two platforms, and even a few applications on the Salesforce side of things, but they are usually premium offerings sold at ridiculously high prices. Effectively, this puts them out of reach for the person just starting an e-commerce site.<\/p>\n<p>WordPress is a fantastic web platform, and it is probably used for most of your front-end sales process. And because WordPress is not exactly the smoothest running CRM, your customer data is either ignored completely, or kept solely on Salesforce (and then ignored). <\/p>\n<p>And that\u2019s exactly why Salesforce makes the Web-to-Lead form available to us.<br \/>\n&nbsp;<\/p>\n<h2>Salesforce Web-to-Leads<\/h2>\n<p>Your Salesforce account includes a feature called Web-to-Leads, which lets you design a form with contact fields you wish to track, and then gives you the HTML code to install that form on nearly any website &#8211; including your WordPress powered blog.<\/p>\n<h3>Creating a Web-to-Lead Form<\/h3>\n<p>Log into your Salesforce account and locate the SETUP menu. It will be located in the drop down menu that is your name in the top right corner of the site.<\/p>\n<figure id=\"attachment_106126\" class=\"wp-caption alignnone\" data-caption=\"true\"><a rel=\"lightbox[106101]\" class=\"blog-thumbnail\" href=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/SETUP-Menu.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-ratio-4-1 wp-image-106126\" title=\"SETUP Menu\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/SETUP-Menu-600x257.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"600\" height=\"257\" \/><\/a><figcaption class=\"wp-caption-text\">Salesforce Setup Menu located under your name in the top right of the application<\/figcaption><\/figure>\n<p>Once there, on the left sidebar admin panel, navigate to APP SETUP, underneath the \u201cCustomize\u201d option choose \u201cLeads\u201d and then **Web-to-Lead.**<\/p>\n<p>In your Web-to-Lead settings, make sure Web-to-Lead is enabled. If not, click the edit button and enable it. Save your changes and return to the Web-to-Lead settings area.<\/p>\n<figure id=\"attachment_106128\" class=\"wp-caption alignnone\" data-caption=\"true\"><a rel=\"lightbox[106101]\" class=\"blog-thumbnail\" href=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/Create-Web-to-Lead-Form.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-ratio-3-2 wp-image-106128\" title=\"Create Web to Lead Form\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/Create-Web-to-Lead-Form-470x235.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"470\" height=\"235\" \/><\/a><figcaption class=\"wp-caption-text\">Enable your Salesforce Web-to-Lead form in the customize app setup area<\/figcaption><\/figure>\n<p>Click the \u201cCreate Web-to-Lead Form\u201d button to create a new form for usage in your website.<\/p>\n<p>In the box on the left you\u2019ll see all the fields available for usage. The box on the right shows the fields you\u2019ve selected for the actual form.<\/p>\n<p>Underneath the boxes you\u2019ll see space to enter a URL. This is the page to which you\u2019ll be redirecting users after they fill out the form on your site. It\u2019s not required, but it\u2019s a nice touch to bring users to a page that lets them know the form has been submitted successfully and that you\u2019ve received their info. Of course, this requires you to already have that page operating on your site.<\/p>\n<p>When you\u2019re happy with the fields and have filled out the redirect URL, click the \u201cGenerate\u201d button.<\/p>\n<h3>Copying the Web-to-Lead Form Code<\/h3>\n<p>Salesforce automatically generates the required HTML code to produce the web-to-lead form. Highlight the code in the window, copy it, and visit the WordPress post or page on which you\u2019d like that form to appear.<br \/>\n&nbsp;<\/p>\n<h2>Editing the Web-to-Lead Form in WordPress<\/h2>\n<p>Take the code from Salesforce and paste it into the HTML code area of your post or page editor. In WP 3.5, that area of the post \/ page editor was named \u201ctext\u201d and its tab can be found at the top right of the editing area.<\/p>\n<p>Unfortunately, Salesforce gives us some extra code that is not needed. These are commented lines and a definition of character set, which WordPress already defines.<\/p>\n<p>Therefore, you can delete everything before (but not including) this line:<br \/>\n{code type=php}<\/p>\n<form action=\"https:\/\/www.salesforce.com\/servlet\/servlet.WebToLead?encoding=UTF-8\" method=\"POST\"><\/code><br \/>\nYou\u2019ll also want to delete the commented section, which looks like this:{code type=php}<br \/>\n<!--  -------------------------------------------  --><br \/>\n<!--  NOTE: These fields are optional              --><br \/>\n<!--  <input type=\"hidden\" name=\"debug\" value=1    --><br \/>\n<!--  <input type=\"hidden\" name=\"debugEmail\"       --><br \/>\n<!--  value=\"yourname@email.com\">           --><br \/>\n<!--  -------------------------------------------  --><br \/>\n<\/code>This is optional code to help developers debug the form, but we wont be needing that here.<\/p>\n<h3>Viewing the Web-to-Lead Form On a WordPress Page<\/h3>\n<p>What you\u2019re left with is clean form code in HTML. When you\u2019re done editing your page, you can publish and view it.<\/p>\n<figure id=\"attachment_106130\" class=\"wp-caption alignnone\" data-caption=\"true\"><a rel=\"lightbox[106101]\" class=\"blog-thumbnail\" href=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/Web-form-on-page-no-css.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-ratio-4-1 wp-image-106130\" title=\"Web form on page - no css\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/Web-form-on-page-no-css-600x634.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"600\" height=\"634\" \/><\/a><figcaption class=\"wp-caption-text\">Web-to-Lead form without styling<\/figcaption><\/figure>\n<p>The form input boxes are placed just to the right of our form labels. These two field columns are way too close together, so we\u2019re going to make some css changes to make our form more pleasing to the eye.<\/p>\n<p>But first, we\u2019ll need to add some classes to the Web-to-Lead form code, which will make styling much easier, and make sure that changes we make here don\u2019t affect other forms that might be on our site already.<\/p>\n<h3>Adding Classes to the Salesforce Web-to-Lead Form Code<\/h3>\n<p>Return to your WordPress page HTML tab. We\u2019re going to add some classes to these form elements.<\/p>\n<p>Find the first line of the form code. It should look like this:<br \/>\n{code type=php}<\/p>\n<form action=\"https:\/\/www.salesforce.com\/servlet\/servlet.WebToLead?encoding=UTF-8\" method=\"POST\"><\/code><br \/>\nWe\u2019re going to add a class by inserting the words id=\u201csfwtlform\u201d right after the word \u201cform\u201d. Your edited line should then be as follows:<br \/>\n{code type=php}<\/p>\n<form id=\"sfwtlform\" action=\"https:\/\/www.salesforce.com\/servlet\/servlet.WebToLead?encoding=UTF-8\" method=\"POST\"><\/code><br \/>\nNow, find the last line of the form code, before the closing line for the form. This is the code that renders the form button.<br \/>\n{code type=php}<input type=\"submit\" name=\"submit\" \/><\/code><br \/>\nWe\u2019re going to add an id to this code as well: id=&#8221;sfwtlbutton\u201d. This will allow us to style the button separate from the other form input fields. The edited line of code should look like this:{code type=php}<input id=\"sfwtlbutton\" type=\"submit\" name=\"submit\" \/><\/code>Save your changes and re-publish the page. This wont change the look of your front-end form&#8230;yet. We\u2019ll do that in a moment with some CSS.<\/p>\n<p>A note regarding pasting code: sometimes when you copy and paste code from a browser into an editor straight double quotes copy over as curly quotes. This will throw an error, so we recommend actually typing the id=\u201csfwtlform\u201d straight into the form code, rather than copying it from this article and pasting it in. <\/p>\n<form action=\"https:\/\/www.salesforce.com\/servlet\/servlet.WebToLead?encoding=UTF-8\" method=\"POST\">&nbsp;<\/p>\n<h3>Cleaning Up Your Web-to-Lead Form with CSS<\/h3>\n<p>The idea of editing your CSS is to make this web-to-lead form more closely match the look and feel of your site. To do that, we\u2019ll be editing the style.css file.<\/p>\n<p>In my example, I\u2019m using a stock installation of the Twenty Twelve theme on WordPress 3.5. That style sheet is located in the theme directory. Your file will likely be in a similar place, and that path will look something like this:<br \/>\nhttp:\/\/YOURSITE.com\/wp-content\/themes\/YOURTHEMENAME\/style.css<\/p>\n<p>You&#8217;ll need to use a custom code editor or edit the theme file directly in the WordPress code editor (not recommended). Once you have that file opened, you can create a new section at the bottom of the file and enter the following code:<br \/>\n{code type=php}<br \/>\n\/* Salesforce Web to Lead Styling *\/<br \/>\n#sfwtlform label {width: 150px; display: inline-block;}<br \/>\n#sfwtlform input {width: 200px;}<br \/>\n#sfwtlform #sfwtlbutton {width: 100px;}<br \/>\n<\/code><\/p>\n<p>Don\u2019t worry, we\u2019ll break it down line by line for you.<\/p>\n<p>The fist line of code is a comment. It\u2019s not actually required, but it helps keep our code organized:<br \/>\n{code type=php}<br \/>\n\/* Salesforce Web to Lead Styling *\/<br \/>\n<\/code><\/p>\n<p>The second line tells our browser to target the form with an id = sfwtlform, and only that form.<br \/>\n{code type=php}#sfwtlform label {width: 150px; display: inline-block;}<\/code><br \/>\nThat will make sure any styling we do here applies only to this form and no other forms that might already exist on your site, like email newsletter forms.<\/p>\n<p>Here, we are setting the label to display as an inline block element, which makes setting a width of 150 pixels possible too. That gives us even separation between the label and the input field as shown.<\/p>\n<figure id=\"attachment_106131\" class=\"wp-caption alignnone\" data-caption=\"true\"><a rel=\"lightbox[106101]\" class=\"blog-thumbnail\" href=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/input-fields-separated.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-ratio-4-1 wp-image-106131\" title=\"input fields separated\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/input-fields-separated-600x176.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"600\" height=\"176\" \/><\/a><figcaption class=\"wp-caption-text\">Custom CSS can help separate form fields, making them easier to read and fill out<\/figcaption><\/figure>\n<p>The third line tells the browser that the input fields should be 200 pixels wide.<br \/>\n{code type=php}#sfwtlform input {width: 200px;}<\/code><br \/>\nThis gives our visitors a bit more room to enter their information.<\/p>\n<p>The fourth and final line tells the browser to make the submit button only 100 pixels wide.<br \/>\n{code type=php}#sfwtlform #sfwtlbutton {width: 100px;}<\/code><br \/>\nThe submit button is also an input button, so without this line, the submit button at the bottom of the form will be as long as the input text fields, which would look horrible.<br \/>\n&nbsp;<\/p>\n<h2>The Finished Product<\/h2>\n<p>When you\u2019re all done, the finished product should look something like this:<\/p>\n<figure id=\"attachment_106132\" class=\"wp-caption alignnone\" data-caption=\"true\"><a rel=\"lightbox[106101]\" class=\"blog-thumbnail\" href=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/Finished-Form.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-ratio-4-1 wp-image-106132\" title=\"Finished Form\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/Finished-Form-600x578.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"600\" height=\"578\" \/><\/a><figcaption class=\"wp-caption-text\">The finished form with custom CSS changes made<\/figcaption><\/figure>\n<p>The finished form is much cleaner and easier for your users to read and fill out. The labels are lined up correctly, and the space before the input field is uniform. The input fields are of uniform length, giving the user more room to enter longer lines of text without having to worry about scrolling.<\/p>\n<p>Of course, you can change the pixel widths, and even the colors, of these form fields to more closely match your site design.<br \/>\n&nbsp;<\/p>\n<h2>Your New Lead in Salesforce<\/h2>\n<p>When a visitor fills out the Web-to-Lead form, his or her information will automatically be sent to your Salesforce application, and placed in the LEADS section. That makes following up with your potential customers much easier than searching the member\/user fields when trying to use WordPress as a CMS.<\/p>\n<p><figure id=\"attachment_106133\" class=\"wp-caption alignnonecgridcgridcgridcgrid\" data-caption=\"true\"><a rel=\"lightbox[106101]\" class=\"blog-thumbnail\" href=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/Salesforce-Lead-Detail.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-ratio-full wp-image-106133\" title=\"Salesforce Lead Detail\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2012\/12\/Salesforce-Lead-Detail-800x192.png\" alt=\"Post image\" aria-hidden=\"true\" width=\"800\" height=\"192\" \/><\/a><figcaption class=\"wp-caption-text\">Contact view inside the Lead dashboard of the Salesforce CRM<\/figcaption><\/figure><br \/>\n&nbsp;<\/p>\n<h2>Summary<\/h2>\n<p>Without any fancy plugins and just a few lines of custom code you\u2019ve added a form that integrates your WordPress website with your Salesforce CRM.<\/p>\n<p>Now, all that\u2019s left to do is sit back and watch the leads pile up!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to integrate Salesforce CRM with your WordPress site and turn it into a lead generating machine!<\/p>\n","protected":false},"author":70852,"featured_media":106160,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263],"tags":[],"tutorials_categories":[],"class_list":["post-106101","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/106101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/70852"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=106101"}],"version-history":[{"count":1,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/106101\/revisions"}],"predecessor-version":[{"id":153641,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/106101\/revisions\/153641"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/106160"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=106101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=106101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=106101"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=106101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}