Quickstart
The SDK runs in server mode: your popups, triggers, and targeting live in Deepdots and are fetched at runtime. You only need to mount the SDK, hand it your API key, and start it.
1. Install
Section titled “1. Install”npm install @magicfeedback/popup-sdk2. Initialize and auto-launch
Section titled “2. Initialize and auto-launch”import { DeepdotsPopups } from '@magicfeedback/popup-sdk';
const popups = new DeepdotsPopups();
popups.init({ mode: 'server', apiKey: 'YOUR_PUBLIC_API_KEY', userId: 'customer-123', // optional — your internal user identifier});
popups.autoLaunch();That’s enough for popups to appear at the moments configured in Deepdots.
3. (Optional) Subscribe to events
Section titled “3. (Optional) Subscribe to events”If you want to track popup interactions in your analytics, subscribe to the SDK events.
popups.on('popup_shown', (event) => analytics.track('popup_shown', event));popups.on('survey_completed', (event) => analytics.track('survey_completed', event));4. (Optional) Fire a business event
Section titled “4. (Optional) Fire a business event”If any of your popups in Deepdots are configured with an event trigger, fire that event from your code whenever the business condition is met.
popups.triggerEvent('checkout_completed');See Triggers for the full list of trigger types and code examples.
That’s it
Section titled “That’s it”You should not need to define popup payloads in code. Popups, copy, triggers, cooldowns, and route targeting are all managed in Deepdots.