Integrating OptiMonk campaigns with Salesfore

You can send your leads from OptiMonk to Salesforce when they complete a popup form, and take advantage of their powerful tools for managing the leads. It may come handy if you run marketing campaigns on a regular basis, so that the subscribers who signed up via OptiMonk will also get news about your upcoming promotions and news.

There are two ways to integrate OptiMonk with your Salesforce account. You can use a simple JavaScript code and send your subscriber data to Salesforce via a Web-To-Lead form. If you are an Enterprise Salesforce user, you can also use OptiMonk’s built-in integration, which provides additional features.

To set up integration with Salesforce using JavaScript code, please follow these steps:

1. Log in to your OptiMonk admin dashboard. Choose the campaign you would like to use with the Salesforce integration, and then click on the name of the popup or the pencil icon to Edit the popup.

2. On the Edit page, click on the CSS & JS editor link at the top of the ‘Design’ section in the left sidebar. This will open the editor at the bottom of the page. Click on the JS editor button in the top left of the editor window that appears.

3. Copy and paste the following JavaScript code into the JS editor window.:

$(document).on('ready', function() {
	$('.OM-popup-button[name="submit"]').on('click', function (){
		if (OptiMonk.validate('.OM-form:first')) {

If you are building a custom popup, don’t forget to wrap the JavaScript code with <script></script> tags, i.e. – place <script>at the beginning of the code, and </script> at the end of the code for it work correctly.


4. Substitute [your-oid] in the code with the OID provided by Salesforce. To locate your OID, log into your Salesforce account, go to Setup -> Company Profile -> Company Information, and locate your ‘ Organization ID’. Copy and paste it into OptiMonk.Integration.Salesforce.webToLead("[your-oid]"), replacing [your-id]. Be sure to keep the quotation marks so the code will work correctly.


5. Click on the Save button at the top right of the OptiMonk edit window, and you’re done. Repeat the process for every Campaign and Variant you would like to use with Salesforce Web-to-Lead.

To set up integration for Salesforce Enterprise Users with the built-in OptiMonk integration, please follow these steps:

Go to Integrations and click on Salesforce in the window that appears.


4. Now you have to establish a connection to Salesforce. By clicking on the Authentication link, you will be redirected to the Salesforce login screen. Enter your Salesforce credentials to log in to your account. When you successfully sign in, you will be redirected back to the Campaign Settings page at OptiMonk, and the options to set up the Salesforce integration will appear.

5. Use the first drop-down menu to tell Salesforce whether to store your subscribers as Contacts or Leads. 

6. You can also segment your contacts or leads based on their source. To do so, select a field from the drop-down menu where you’d like to store the source information. Then, enter the text that you would like sent to this field to indicate the audience segment. This can be any text you choose. For example, you can use "OptiMonk" as the text to show which subscribers are from OptiMonk. Or, you can use "OptiMonk Winter Campaign" as the text to segment even further, showing which subscribers are from which campaign. Please note: You must choose a field that is suitable to store this information. For instance, you can’t choose a field that is supposed to store an email address, and you can’t store a text value in a field that only accepts numbers or dates.

7. Once you’ve chosen how to store your subscribers from OptiMonk, scroll to the top of your admin dashboard and click on the Save button to save the changes.

That's it! Now, whenever a visitor signs up on your OptiMonk popup, they will automatically be added to the Salesforce list you selected, with the custom field you specified.

Have more questions? Submit a request