Callbacks

Callbacks enable custom functionality such as:

  • Integrating with custom vendors that use tag-based integrations on your website

  • Ingesting data from the dataLayer

  • Creating custom logic or functionality

Two Ways To Implement Callbacks

JavaScript

pi('oncomplete', function(survey) {
     ... your callback code here ...
  });

In Console

You can manage callback code in Console, described in more detail here.

Callback Types

Type
Executes When
Details

On Impression onimpression

Platform delivers a survey to the page

On Viewed Impression onview

Survey appears in the viewport

When a survey is configured to display as soon as the page loads, the Viewed Impression callback will execute right after the Impression callback

Conversely, when a survey is dependent on user behavior (time on page, scroll percentage, etc.) or is attached to a page section that is not visible on page load, the Viewed Impression callback will only execute when the survey becomes visible

On Answer onanswer

User submits an answer

Can fire multiple times for a multiple question survey

On Complete oncomplete

All questions in a survey path are answered

When a survey contains a single question, the Oncomplete callback will execute right after the Onanswer callback

On Close onclose

The survey is closed

On Click onclick

An anchor tag within a custom content question is clicked.

This callback is only available to use when the account setting "Custom Content Link Tracking" is enabled.

Last updated