Survicate library loaded on your page provides _sva object that can be used to call few simple methods.



If you need to run targeting script again without reloading page run:


It is useful for Single Page Applications / Progressive Web Applications.

Get visitor ID

You can track visitors via the visitor ID.

var visitorId = _sva.getVisitorId();

Visitor ID can be null. Value is assigned as soon as any survey answer is given or two-way integration is enabled.

Reset visitor

_sva.destroyVisitor(function() {
    console.log('Visitor destroyed.');

This function resets all visitor data(including answers, visits etc.) stored in localStorage / sessionStorage. It will not change any data that Survicate already collected.

You can optionally provide callback function as a first parameter that will be triggered after visitor cleanup.

Be noted that this function will not trigger any survey for “new” visitor, but you can always call _sva.retarget(); in callback function.

Show survey

_sva.showSurvey(id, options);

This function shows a survey based on the given id. Returns true if the survey was rendered and false otherwise (e.g. another survey is already displayed or a visitor already answered called survey).

You can optionally provide options object as a second parameter to specify the display details.

const options = {
  forceDisplay: true,
  displayMethod: 'delayed',
  displayOptions: {
    delay: 5

_sva.showSurvey('abc1234', options);


Property Type Description
forceDisplay boolean If true, currently rendered survey will be closed in favour of the new survey.
displayMethod string Use this option in order to overwrite the current displaying configuration. Possible values: [‘immediately’, ‘delayed’, ‘exitIntent’, ‘onScroll’].
displayOptions object See below for available options. Applicable and required only for displayMethod values ‘delayed’ and ‘onScroll’.


Property Type Description
delay integer Delay in seconds. Applicable and required only for displayMethod = ‘delayed’.
scrolledPercentage integer Percentage of the page that was already scrolled. Applicable and required only for displayMethod = ‘onScroll’.