How do I assign my leads to a specific campaign in Salesforce? (Custom Salesforce Integration)


UPDATE: Please read if you are using this integration.

Salesforce is about to deprecate the old web-to-lead URL around June 2017. Please make sure to update your POST URL from:”


For more information see salesforces documentation here:

Original post:

Hey everyone,

As some of you may know, our current Unbounce to Salesforce integration is unable map your leads to specific campaigns. This is due to a limitation of the Salesforce API. Salesforce does provide an alternative which is embedding a Salesforce ‘web-to-lead’ form. However for some this may not be ideal as your data will no longer be captured on our end and the form cannot be styled using the page builder tools.

Using a method similar to Salesforce’s Web-to-lead forms you can use and retain your Unbounce forms features while sending those leads to specific campaigns.

I do need to caution this requires some knowledge of HTML or CSS. Please proceed with caution and only if you have the skillset to do so.


Finding your Salesforce field IDs

Create a Web-to-lead form on salesforce with your required fields. We won’t be using this code but we will be using this for reference.…

Be sure to include the “Campaign” field if you wish to assign the leads to a specific campaign. After you generate the code the field ID’s should be visible in the HTML.

Add the following hidden fields on your Unbounce form: retURL, oid, Campaign_ID

Give these hidden fields the same default values as in the salesforce code (set retURL to your thank you page URL)

Set your forms confirmation to ‘POST form data to URL’ and set it to the URL below:

Mapping your Unbounce fields to Salesforce
Salesforce is case sensitive and very particular about the field IDs. If there is even the slightest mismatch, Salesforce will ignore that field data.

You can find your salesforce field IDs in the web-to-lead code:

and on unbounce the form field IDs can be seen in the form builder. It’s the text box labelled Field Name and ID.

Uncheck the box Auto-generate from Field Label and set the value to what Salesforce requires

Now after a visitor submits your form they will be taken to your ‘thank you page’ and the lead data will be sent into Salesforce and into the proper campaign.

Hope you find this helpful! Feel free to comment below or reach out to us directly at

How comprehensive is the integration?
Best Practices for Tracking Campaigns

This is a super-clear post thanks. I followed your steps precisely, and met with success, but the Javascript created two leads: one with full information but not in the campaign, and one with skeletal information (no email or phone but lead source miraculously included).

Any ideas about what I’m doing wrong?


Hi Yulia - do you have the built-in Salesforce integration enabled for the page as well? That would cause the same lead to be pushed twice with varying info. If you’re using this method, you’ll want to remove the in-app integration.


Hey Yulia - I’d be happy to take a closer look and help narrow down the issue. I’ll start a support ticket for you. Look out for my email shortly!


Very helpful support offline from Johnny, but we abandoned this approach. Much of the functionality of the standard integration is either lost, or requires lots of custom code and manual adjustments on every variant of every landing page. Way too hard / manual / error-prone. We will just put a routine into Salesforce to look for new leads with certain field values and push them into the right campaign. Appreciate the offline assistance though - plentiful and clear.


Hey, we got this to work beautifully, and have it running on several pages.

But we’ve been having trouble recently trying to the javascript to work with pre-filled forms via URLs (…).

Any idea? Do you want me to send a sample, some code, etc?



Hey Natalie - I’d be happy to take a look and help out. I’m starting a support ticket now. Lookout for my email!



Thank you so much :slight_smile:


Anytime Natalie!

On that note, I haven’t seen a reply to my email yet. If you didn’t get anything from me try sending a email to and address it to me :slight_smile:


Just saw your email Natalie! Hopefully you get my reply. If not let me know here and i’ll try sending you another email from my personal email


Johnny, having tried and abandoned this approach (we lost the ability to personalise the confirmation dialogue), we have come back to it, and I can report that it is working well. thank you for the clarity. A few things I learned:
1 - try all steps excluding the javascript first. Naming the hidden fields correctly in the form, and pushing to your Salesforce page does most of the heavy lifting
2 - add only those fields to your javascript that need to be translated (less is more). The Javascript is simple and powerful - it maps field names like return URL correctly.


Top notch post + video! Thanks.


Can we still pass the page URL this way? Or the landing page name?


Hi Vinnie Ð you definitely can. You’ll just need to add a hidden field and set the Default Value as your page URL or landing page name, like so:

Once that’s created, just add a line to the script for renaming fields in Johnny’s original post to make sure they’re getting pushed to the correct corresponding Salesforce field and you should be good to go.


Hey everyone!

We’ve made some exciting improvements to our forms which will allow this integration to be a lot more simplified safer to implement.

Our forms now allow you to separate what your field label says and what the actual Field ‘Name’ and 'ID" properties are.

It also allows you to input uppercase lettering if needed.

What this means for this custom integration is you no longer need the javascript workaround to rename your fields.

I’ve updated the main post to reflect these changes. But if you have any further questions about the improvements to our forms let us know!


What if I don’t want them to see a “Thank You” page and I just want the form dialog box to appear? I don’t want to pass my users anywhere.

Also can I still pass the Submitter IP and other Unbounce focused fields in Salesforce?


Hi there - in this case, when Johnny says “thank you page” he is referring to the form confirmation dialog in Unbounce.

As far as what fields you can pass, as long as you have a corresponding field in Salesforce, you should be able to map them together.


So I can expect that Unbounce is going to also pass the IP address, Unbounce Page ID, Submission Time, and Unbounce Page Varient information when I use the webhook to submit to my web-to-lead form?


I’m really sorry, but I actually had this mixed up with a different workaround.

So, you will have to set the retURL and fire over to the Salesforce post page, so you won’t be able to serve the form confirmation dialog.

You should be able to grab IP Address and Time Submitted, as those are pushed through on a Post to URL–you’ll need to configure your Salesforce web-to-lead so the corresponding fields are “ip_address” and “time_submitted” as that’s how they’re pushed out of Unbounce though.

Again, sorry for the confusion! I was thinking of an older workaround that used to work with a different external CRM.


Hi, Unbounce! Following the directions as supplied in this post, we’re just not seeing new leads flow into Salesforce at all. Clearly we’re missing a step, but we just can’t figure out what! Any tips on what to look for?