Newsletter Subscription
Collect email subscribers directly from your website with beautiful, ready-to-use UI components or a simple programmatic API.
Installation
The newsletter module is included in inline.js. No additional scripts needed — it's available automatically when you load the Cuoral widget:
<script
src="https://js.cuoral.com/inline.js"
data-cuoral-key="your-public-key"
></script>The CuoralNewsletter object is then globally available.
Method 1: Modal Popup
Show a beautiful animated modal to collect subscriptions. Great for exit-intent, button clicks, or timed popups.
CuoralNewsletter.showModal({
title: "Stay in the loop",
subtitle: "Get the latest updates delivered to your inbox.",
buttonText: "Subscribe",
color: "#6366f1",
showName: true,
showConsent: true,
consentText: "I agree to receive emails and can unsubscribe anytime.",
successTitle: "You're subscribed! 🎉",
successMessage: "Check your inbox for confirmation.",
tags: ["website-popup"],
onSuccess: (data) => {
console.log("Subscribed!", data);
},
onError: (error) => {
console.error("Failed:", error);
},
onClose: () => {
console.log("Modal closed");
},
});Modal Options
title
string
"Stay in the loop"
Modal heading
subtitle
string
"Get the latest updates..."
Description text
buttonText
string
"Subscribe"
Submit button label
color
string
"#6366f1"
Brand/theme color (hex)
showName
boolean
false
Show first & last name fields
showConsent
boolean
true
Show consent checkbox
consentText
string
"I agree to receive..."
Custom consent label
successTitle
string
"You're subscribed! 🎉"
Title after success
successMessage
string
"Thanks for subscribing..."
Message after success
tags
string[]
[]
Tags for subscriber segmentation
onSuccess
function
null
Callback with subscriber data
onError
function
null
Callback with error details
onClose
function
null
Callback when modal is closed
Method 2: Inline Form Embed
Embed a form directly into any element on your page. Perfect for footers, sidebars, or dedicated signup sections.
Embed Options
target (1st arg)
string | Element
—
CSS selector or DOM element
title
string
"Subscribe to our newsletter"
Form heading
subtitle
string
"Stay updated..."
Description text
buttonText
string
"Subscribe"
Submit button label
color
string
"#6366f1"
Brand/theme color (hex)
showName
boolean
false
Show first & last name fields
layout
string
"stacked"
"stacked" or "inline"
tags
string[]
[]
Tags for subscriber segmentation
onSuccess
function
null
Callback with subscriber data
onError
function
null
Callback with error details
Layout Options
"inline"— Email input and button on the same row (compact, great for headers/footers)"stacked"— Fields stacked vertically (traditional form layout)
Note: Inline layout only works when
showNameisfalse. If name fields are enabled, it falls back to stacked.
Method 3: Programmatic Subscribe
For custom forms where you handle the UI yourself. Just pass the email and get the result.
Subscribe Options
email
string
✅ Yes
Subscriber's email address
firstName
string
No
First name
lastName
string
No
Last name
tags
string[]
No
Tags for segmentation
customFields
object
No
Custom key-value metadata
Response Format
Examples
Trigger modal on button click
Embed in footer
Exit-intent popup
Custom form integration
Notes
org_identifieris automatically set from yourdata-cuoral-keyattribute.source_detailsauto-captures the current page URL where the subscription happened.consentis auto-generated with a timestamp when the user subscribes.The modal auto-closes 4 seconds after successful subscription.
All forms include built-in email validation.
Responsive design works on all screen sizes.
Last updated