Installing the Embed Script
The Cueflow embed script displays your messages to users in your website or application.
Basic Installation
Add the script tag to your HTML, typically before the closing </body> tag:
<script src="https://script.cueflow.so/embed/cueflow.js"
data-workspace-id="YOUR_WORKSPACE_ID"></script>Initialize with User Data
After the script loads, call Cueflow.init() with your user's information:
Cueflow.init({
id: 'user-123', // Required - unique identifier
email: '[email protected]',
name: 'Jane Smith',
plan: 'pro',
role: 'admin',
signedUpAt: '2024-01-15'
});Required Fields
id
string
Required. Unique identifier for the user (your internal user ID)
Standard Fields
email
string
User's email address
name
string
User's display name
phone
string
Phone number
plan
string
Subscription plan (e.g., "free", "pro", "enterprise")
role
string
User role (e.g., "admin", "member")
signedUpAt
string
ISO date when user signed up
Custom Attributes
You can pass any additional properties as custom attributes:
Custom attributes appear in Cueflow and can be used for targeting rules.
Single Page Applications (SPA)
Cueflow automatically detects navigation in SPAs by listening to the History API. Messages are re-evaluated on each page change.
If you need to manually trigger a message check (e.g., after a state change):
Updating User Data
When user attributes change, update Cueflow to refresh targeting:
Tracking Events
Track user actions to trigger event-based messages:
Cleanup
When a user logs out or you need to remove Cueflow:
This removes all messages and cleans up event listeners.
Framework Examples
React
Vue
Next.js
Troubleshooting
Messages not appearing
Check that the Workspace ID is correct
Verify
Cueflow.init()is called with a valididEnsure your message is Published (not Draft)
Check targeting rules match the current user/page
Console errors
Cueflow: user.id is required- Make sure you pass anidfield to initCueflow: Already initialized- Only call init once per page loadCueflow: Not initialized- Call init before using other methods
Last updated