Initialization Methods
init()
Initializes the SDK with configuration options. Must be called before any other methods.Configuration object for SDK initialization
If
init() is called when the SDK is already initialized, it will log a warning and return without re-initializing.deepdots-popups.ts:44-89
autoLaunch()
Enables auto-launch functionality with configured triggers. Starts all triggers derived from popup definitions.- In
clientmode: Starts triggers immediately - In
servermode: Waits for popup definitions to be fetched, then starts triggers - Throws error if SDK is not initialized
deepdots-popups.ts:92-102
Display Methods
show()
Shows a popup immediately without waiting for a trigger. Supports both legacy options and popup definitions.Either a complete PopupDefinition object or legacy ShowOptions
deepdots-popups.ts:111-129
showByPopupId()
Shows a popup by its definition ID. Useful when multiple popups reuse the same surveyId.The unique identifier of the popup definition to show
If no popup definition is found with the given ID, the method logs a debug message and returns without showing anything.
deepdots-popups.ts:132-139
Event Methods
triggerEvent()
Triggers popups configured withtrigger.type = 'event' and matching event name. Shows the first eligible popup that matches conditions and segments.
The event name to trigger. Must match the
value field in popup definitions with triggers.type = 'event'- Normalizes and trims the event name
- Finds all popup definitions with matching event triggers
- Evaluates conditions (answered state, cooldown, segments)
- Shows the first matching popup that passes all checks
- Logs debug messages if no popups match or conditions block display
Empty or whitespace-only event names are ignored and logged in debug mode.
deepdots-popups.ts:202-230
on()
Registers an event listener for SDK events.The type of event to listen for:
'popup_shown': When a popup is displayed'popup_clicked': When a popup is interacted with'survey_completed': When a survey is completed
Callback function that receives the event object
popup_shown: May includepopupId,userIdpopup_clicked: May includepopupId,action,userIdsurvey_completed: May includepopupId,userId
deepdots-popups.ts:507-512
off()
Removes an event listener.The type of event to stop listening for
The exact listener function that was registered with
on()deepdots-popups.ts:515-520
Configuration Methods
configureTriggers()
Manually configures triggers for auto-launching popups. Normally triggers are derived automatically from popup definitions, but this method allows manual override.Array of trigger configurations
This method is typically not needed. Triggers are automatically derived from popup definitions when using
autoLaunch().deepdots-popups.ts:142-148
setRenderer()
Sets a custom renderer for popups. Allows platform-specific or custom UI implementations.Custom renderer implementation
If
init() is implemented, it will be called automatically if the SDK is already initialized when setRenderer() is called.deepdots-popups.ts:622-627
State Management Methods
markSurveyAnswered()
Manually marks a survey as answered. Prevents popups withcondition: [{ answered: false }] from showing for this survey.
The survey ID to mark as answered
This method is called automatically when a
survey_completed event is emitted. You typically only need to call it manually if tracking survey completion through an external system.deepdots-popups.ts:303-305
Related Resources
Configuration
Learn about all configuration options and type definitions
DeepdotsPopups Class
Return to the main class overview