Server Mode (Recommended)
Server mode is the recommended setup for production integrations. Popup definitions are managed remotely via the Deepdots API and fetched at runtime.In server mode, the SDK automatically waits for popup definitions to load from the API before activating triggers when you call
autoLaunch().Configuration
Environment Configuration
ThenodeEnv parameter determines which API endpoint the SDK connects to:
nodeEnv: 'production'→https://api.deepdots.comnodeEnv: 'development'→https://api-dev.deepdots.com
Key Features
- Remote Management: Update popup definitions without redeploying your application
- User Targeting: Pass
userIdto fetch user-specific popup configurations - Automatic Loading: SDK handles fetching and caching popup definitions
- Real-time Updates: Changes to popup definitions take effect immediately
The
userId parameter is optional but recommended when popups are targeted to specific users or user segments.Client Mode
Client mode allows you to preload popup definitions directly in your code. This is useful for local development, QA testing, hardcoded fallback flows, and integration testing without API calls.Configuration
Key Features
- No API Dependency: Works without network requests or API keys
- Predictable Behavior: Popup definitions are fully controlled in code
- Fast Testing: Quickly validate trigger behavior and UI flows
- Offline Support: Functions completely offline
In client mode, the property name is
triggers (not trigger), and time_on_page values are defined in seconds.When To Use Each Mode
- Server Mode
- Client Mode
Use server mode for:
- Production integrations where popup definitions are managed by your marketing or product team
- Dynamic targeting based on user segments or behavior
- A/B testing and experimentation workflows
- Frequent updates to popup content without redeploying
- Multi-environment setups (development, staging, production)
Configuration Fields
Both modes support the following configuration options:| Field | Type | Required | Description |
|---|---|---|---|
mode | 'server' | 'client' | No | Execution mode (defaults to 'client') |
apiKey | string | Server mode only | Your public API key for authentication |
nodeEnv | 'development' | 'production' | Server mode only | Determines API endpoint |
userId | string | No | User identifier for targeted popups |
debug | boolean | No | Enable debug logging to console |
popups | PopupDefinition[] | Client mode only | Array of popup definitions |
Behavior Differences
Loading Sequence
Loading Sequence
Server Mode:
- Call
init()with API key - SDK fetches popup definitions from API
- Call
autoLaunch()(deferred until definitions load) - Triggers activate automatically
- Call
init()with popup definitions - Call
autoLaunch() - Triggers activate immediately
Error Handling
Error Handling
Server Mode: If the API request fails, the SDK logs an error and continues with an empty popup list. No popups will be shown.Client Mode: Errors only occur if popup definitions have invalid structure. Use
debug: true to see validation warnings.