Exit Intent on Mobile

How Zigpoll detects exit intent on mobile devices

On desktop, exit intent is detected by tracking the user's cursor as it moves toward the top of the browser window. On mobile devices, there is no cursor to track, so a different approach is needed.

How Mobile Exit Intent Works

Zigpoll uses scroll speed detection to infer exit intent on mobile:

  1. The user's scroll position is continuously tracked.

  2. When the user scrolls up, the scroll speed is measured.

  3. If the speed exceeds a threshold, exit intent is triggered.

This works because mobile browsers require users to scroll upward to access the URL bar. Users tend to perform this action swiftly — much faster than scrolling up to read content — making it a reliable signal for exit intent.

Custom Implementation

If you want to implement your own mobile exit intent logic, you can use the Javascript API to trigger a survey programmatically. Here's an example of scroll speed detection:

function myScrollSpeedFunction() {
  const delta = my_scroll();
  if (delta < -80) {
    // Trigger your Zigpoll survey here
    window.Zigpoll.open();
  }
}

var my_scroll = (() => {
  let last_position, new_position, timer, delta, delay = 50;

  function clear() {
    last_position = null;
    delta = 0;
  }

  clear();
  return () => {
    new_position = window.scrollY;
    if (last_position != null) {
      delta = new_position - last_position;
    }
    last_position = new_position;
    clearTimeout(timer);
    timer = setTimeout(clear, delay);
    return delta;
  };
})();

document.addEventListener('scroll', myScrollSpeedFunction);

You can adjust the threshold (default -80) to be more or less sensitive. You might also wait until the user has scrolled at least 50% down the page before initializing this script.

Last updated