Initialization Interfaces
DeepdotsInitParams
Configuration object passed to theinit() method to initialize the SDK.
API key for authentication. Required when using
mode: 'server' to fetch popup definitions from the Deepdots API.Environment setting that determines the API endpoint:
'production': Useshttps://api.deepdots.com'development': Useshttps://api-dev.deepdots.com
Execution mode:
'server': Fetches popup definitions from the Deepdots API at runtime'client': Uses popup definitions provided in thepopupsparameter
When
true, enables debug logging to the console with [DeepdotsPopups] prefix.Array of popup definitions. Required when using
mode: 'client'. Ignored in mode: 'server'.Optional user identifier. Used for:
- Sending with popup events to the API
- User-specific popup targeting (when supported)
types/index.ts:5-19
DeepdotsConfig
Internal configuration interface used after initialization. Similar toDeepdotsInitParams but excludes nodeEnv (which is resolved internally).
This interface is used internally by the SDK. You don’t need to use it directly - use
DeepdotsInitParams when calling init().types/index.ts:20-31
Popup Definition Interfaces
PopupDefinition
Complete definition of a popup, including content, triggers, actions, and targeting.Unique identifier for this popup definition. Used with
showByPopupId() and for internal tracking.Title text for the popup. Part of the definition contract but may not be rendered by all renderers.
Message content for the popup. Supports HTML. Should be sanitized before use.
Trigger configuration that determines when the popup should be shown. See PopupTrigger.
Available actions for the popup (accept, decline, complete, etc.). See PopupActions.
ID of the survey to display when the popup is shown.
ID of the product associated with this popup.
Visual styling options for the popup. See PopupStyle.
Targeting and segmentation rules. See PopupSegments.
types/index.ts:148-158
PopupTrigger
Defines when and how a popup should be triggered.The type of trigger:
'time_on_page': Show after user has been on page for N seconds'scroll': Show after user scrolls to N% of page'exit': Show after user leaves the page (with delay)'click': Show after user clicks element with specific ID'event': Show whentriggerEvent(name)is called with matching name
Value for the trigger, interpretation depends on type:
time_on_page: Number of seconds (e.g.,5for 5 seconds)scroll: Percentage as number (e.g.,50for 50%)exit: Number of seconds to delay after exit (e.g.,2)click: DOM element ID as string (e.g.,'feedback-button')event: Event name as string (e.g.,'search')
Array of conditions that must all be met for the popup to show. See PopupTriggerCondition.
types/index.ts:83-96
PopupTriggerCondition
Defines additional conditions that must be met before a popup can be shown.If
false, the popup will only show if the survey has NOT been answered. If true, shows regardless of answer status.Number of days that must pass after the popup was last shown before it can be shown again. Set to
0 for no cooldown.Multiple conditions in the
condition array are evaluated with AND logic - all must be true for the popup to show.types/index.ts:86-89
PopupActions
Defines the available actions (buttons) for a popup.Primary action to open the survey.
Action to dismiss the popup, optionally with cooldown.
Action to auto-complete the survey with predefined parameters.
Action to start the survey flow.
Back action, same structure as decline.
types/index.ts:98-131
PopupStyle
Visual styling configuration for the popup.Color theme for the popup.
Screen position where the popup should appear:
'bottom-right''bottom-left''top-right''top-left''center'
Optional image URL to display in the popup. Set to
null for no image.The current browser renderer focuses on the embedded form and may not render all style fields. These are part of the definition contract for future renderer implementations.
types/index.ts:134-138
PopupSegments
Targeting and segmentation rules for showing popups.Array of language codes. Currently defined but not actively evaluated by the SDK runtime.
Array of URL paths where the popup should be shown. Supports:
- Full URLs:
'https://example.com/home' - Path fragments:
'/pricing','/home' - Hash routes:
'/#/dashboard'
Additional custom segmentation fields for future extensions.
segments.path is currently the only segment actively evaluated by the SDK runtime. Language and custom segments are accepted but not enforced.types/index.ts:141-145
Trigger Interfaces
TriggerConfig
Internal trigger configuration used by the SDK. Automatically derived fromPopupDefinition.triggers but can also be set manually via configureTriggers().
Trigger type. Note the difference from
PopupTriggerType:'time'instead of'time_on_page'- Values are in milliseconds instead of seconds for time triggers
Trigger value:
time: milliseconds (e.g.,5000for 5 seconds)scroll: percentage (e.g.,50)exit: seconds (e.g.,2)click: element ID (e.g.,'button-id')event: event name (e.g.,'checkout')
Survey ID to show when the trigger fires.
Optional popup definition ID for disambiguation when multiple popups use the same surveyId.
types/index.ts:36-45
Event Interfaces
DeepdotsEvent
Event object emitted by the SDK for popup lifecycle events.The type of event:
'popup_shown': Popup was displayed to the user'popup_clicked': User interacted with the popup'survey_completed': User completed the survey
The survey ID associated with this event.
Unix timestamp (milliseconds) when the event occurred.
Additional event data. Common fields:
popupId: The popup definition IDuserId: User identifier (if configured)action: Action type forpopup_clickedevents (e.g.,'loaded','start_survey','close_icon')
types/index.ts:62-75
EventListener
Callback function type for event listeners.types/index.ts:80
Legacy Interfaces
ShowOptions
Legacy interface for showing popups. Still supported butPopupDefinition format is preferred.
Survey ID to display.
Product ID associated with the survey.
Additional data to pass with the survey.
types/index.ts:50-57
Related Resources
Methods
Explore all available methods and their usage
DeepdotsPopups Class
Return to the main class overview