Skip to main content

Integrating OptinMonster with SendSquared

This guide explains how to send OptinMonster form submission data to SendSquared using the om.Optin.init.submit callback. When a visitor submits an OptinMonster popup or inline form, the integration forwards their information to SendSquared so you can build your contact list automatically.

Prerequisites

  • An active OptinMonster account
  • An OptinMonster campaign (popup, floating bar, inline form, etc.)
  • Your SendSquared list group UUID (token)

How It Works

OptinMonster provides a JavaScript event called om.Optin.init.submit that fires whenever a visitor submits any OptinMonster form on your site. By listening for this event, you can capture the submitted data and send it to the SendSquared API in real time.

Implementation

Add the following script to your website. This can go in your site's header, footer, or wherever you manage custom scripts (e.g., WordPress header/footer scripts, Google Tag Manager, or your theme's custom code area).

<script>
document.addEventListener('om.Optin.init.submit', function(event) {
// Get the submitted form data from OptinMonster
const optinData = event.detail;

// Extract fields — OptinMonster stores the email in optin_email
// and the name in optin_name by default
const email = optinData.optin_email;
const name = optinData.optin_name;

// Only proceed if we have an email
if (!email) return;

// Set the API URL with your SendSquared list group UUID
const token = "your-list-group-uuid";
const apiUrl = `https://app-api.sendsquared.com/v1/pub/popup?token=${token}`;

// Build the API payload
const apiData = {
email: email,
name: name || ''
};

// Send the data to SendSquared
fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(apiData)
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error ${response.status}`);
}
return response.json();
})
.then(data => {
console.log('Successfully sent to SendSquared:', data);
})
.catch(error => {
console.error('Error sending to SendSquared:', error);
});
});
</script>

Configuration

Replace "your-list-group-uuid" with the actual list group UUID from your SendSquared dashboard. You can find this under Lists > List Groups > copy the UUID for the group you want contacts added to.

Adding Custom Fields

If your OptinMonster form collects additional fields (phone, company, etc.), you can include them in the API payload:

const apiData = {
email: optinData.optin_email,
name: optinData.optin_name || '',
phone: optinData.optin_phone || '',
'-custom_field': optinData.optin_custom_field || ''
};

Custom fields in the SendSquared popup API are prefixed with a - character.

Targeting a Specific Campaign

If you have multiple OptinMonster campaigns and only want to send data from a specific one, check the campaign slug or ID in the event data:

document.addEventListener('om.Optin.init.submit', function(event) {
const optinData = event.detail;

// Only process submissions from a specific campaign
if (optinData.optin_slug !== 'my-newsletter-popup') return;

const email = optinData.optin_email;
if (!email) return;

// ... rest of the SendSquared API call
});

Where to Add the Script

WordPress

  1. Install a plugin like Insert Headers and Footers (or use your theme's custom scripts option)
  2. Paste the script into the Footer Scripts section
  3. Save your changes

Other Platforms

Add the script tag anywhere after the OptinMonster embed code on your site. The footer is typically the best location to avoid blocking page rendering.

Troubleshooting

  1. No data arriving in SendSquared — Open your browser's developer console (F12) and submit the form. Look for the Successfully sent to SendSquared log message or any errors.
  2. Email field is empty — Verify your OptinMonster form field is using the default optin_email name. Custom field names can be found in OptinMonster's campaign builder under the field settings.
  3. CORS errors — Contact SendSquared support to whitelist your domain.
  4. Event not firing — Make sure the OptinMonster embed script loads before your integration script. Moving your script to the footer usually resolves this.

For additional support, contact SendSquared support at support@sendsquared.com or +1.855.340.7363.