Skip to content

API

These are the public methods of the DeepdotsPopups class. They cover everything a host application needs to mount the SDK, react to popups, and fire business events.

Initializes the SDK and fetches the popup definitions from Deepdots.

popups.init({
mode: 'server',
apiKey: 'YOUR_PUBLIC_API_KEY',
userId: 'customer-123', // optional
});
FieldRequiredDescription
modeyesAlways 'server' for customer integrations.
apiKeyyesYour Deepdots public API key.
userIdnoIdentifier sent with every popup event.

Starts the triggers derived from the definitions loaded during init(). Call once after init().

popups.autoLaunch();

Fires a custom business event. Any popup in Deepdots configured with an event trigger that matches eventName will be shown (subject to cooldowns and targeting).

popups.triggerEvent('checkout_completed');

See Triggers → event for details.

Shows a popup directly, bypassing triggers. Cooldowns and route targeting are still respected.

popups.show({
surveyId: 'survey-home-001',
productId: 'product-main',
});

Same as show(), but you address the popup by its Deepdots id instead of its survey/product pair.

popups.showByPopupId('popup-home-5s');

on(event, listener) / off(event, listener)

Section titled “on(event, listener) / off(event, listener)”

Subscribe to the SDK events: popup_shown, popup_clicked, survey_completed.

const onShown = (event) => analytics.track('popup_shown', event);
popups.on('popup_shown', onShown);
popups.off('popup_shown', onShown);

See Events for the full payload shape.