Jump to

SDK: Methods

ftools('open', surveyId, options?)

Opens a popup survey. Works only with Manual event tracking on: see When a popup shows. If the survey data is still loading, the popup opens when it arrives.

ftools('open', '__SURVEY_ID__');

ftools('open', '__SURVEY_ID__', {
  force: true,
  metadata: { orderId: 'A-42' }
});
Comparison table
OptionTypeDescription
forcebooleanShow even if the visitor already answered or dismissed the survey.
metadataRecord<string, string | number | boolean>Data for this opening. Replaces metadata from init(), not merged. See Users and metadata.

Not supported for embed surveys.

ftools('close', surveyId, options?)

Closes an open popup survey. Does nothing if the popup isn't open. A popup that waits in the queue is removed from the queue.

ftools('close', '__SURVEY_ID__');
ftools('close', '__SURVEY_ID__', { silent: true });
Comparison table
OptionTypeDescription
silentbooleanDon't count it as the visitor dismissing the survey: no close event, and "Don't show again if dismissed" doesn't apply.

close() doesn't call onClose. Not supported for embed surveys.

ftools('destroy', surveyId)

Removes a survey completely: unmounts it, cancels its triggers and frees its ID. Works for popup and embed surveys. After it, init() with the same ID starts fresh. If the destroyed popup was open, the next popup in the queue opens.

ftools('destroy', '__SURVEY_ID__');

Use it in component cleanup (useEffect cleanup, onUnmounted), especially for embed surveys.

ftools('destroyAll')

Removes every survey, cancels all triggers, removes the feedback button and restores the History API. A later init() starts the SDK again.

ftools('destroyAll');