Skip to content
  • There are no suggestions because the search field is empty.

How to test an exit popup

A/B test exit-intent pop-ups in Convert with proper experimentation rigor

Author Amrin Rajani

IN THIS ARTICLE YOU WILL:


introduction

Testing exit-intent pop-ups is a common way for ecommerce teams to validate offers, messages, or interruption strategies before rolling them out more widely.

An exit-intent pop-up opens when a visitor looks about to leave the page. Convert's Custom Pop-ups feature in the Visual Editor has no exit-intent trigger. A Custom Pop-up can open on a click, when an element scrolls into view, or when an element loads. To test an exit-intent pop-up, add exit-intent code to a variation, as the example in this article shows.

A pop-up you test in Convert is part of an experiment, so it uses the same targeting rules, goals and stats engine as any other test.

What Custom Pop-ups Can Trigger

Custom Pop-ups are built into the Visual Editor. To create one, see Custom Pop-ups in the Visual Editor.

To make a pop-up open, select an element on your page and open the Pop-up Trigger section in the left panel. Choose one of these triggers, then pick the pop-up under Choose Pop-up:

  • None: the pop-up has no trigger on this element.
  • Click: the pop-up opens when a visitor clicks the element.
  • Scroll: the pop-up opens when the element scrolls into view.
  • Load: the pop-up opens when the element loads. It works only on these tags: BODY, FRAME, FRAMESET, IFRAME, IMG, INPUT, LINK, SCRIPT and STYLE. On any other element, the button shows a lock, and its tooltip lists these tags.

Visual Editor with a button selected and the Pop-up Trigger section open: None, Click, Scroll and a locked Load option, with the Choose Pop-up list and the Manage Pop-ups link

None of these triggers reacts to a visitor moving toward the edge of the page. A Custom Pop-up can't show an exit-intent pop-up on its own.

Use Custom JavaScript for Exit-Intent Pop-ups

To test an exit-intent pop-up in Convert today, add JavaScript to a variation. The code watches for exit intent and shows your pop-up. The example in the next section uses an open-source exit-intent library. You can also use Ouibounce.js, as described in How to create an exit pop-up on Convert with Ouibounce.js.

Use custom JavaScript when you:

  • Want an exit-intent trigger
  • Maintain or change a legacy implementation
  • Need highly bespoke behavior that falls outside the scope of Custom Pop-ups
  • Want to test a third-party widget that can't be recreated natively

📒Note: This approach requires custom code and extra QA to make sure experiment results are tracked correctly. Most exit-intent code relies on mouse movement. Touch devices have no mouse to move off the page, so check how your code behaves on mobile.

Which Visitors Does the Experiment Count?

With the default Upon Run trigger on the location, the experience activates when the page loads. Every visitor who matches your location and audience is counted in the experiment, including visitors who never trigger the exit-intent pop-up. Your report then compares all of those visitors, not only the ones who saw the pop-up.

To count only visitors who show exit intent, activate the experience from the exit-intent code. Create a location with the trigger When a callback is called, and call activate() when exit intent is detected. The app shows function (activate, options) { above the code box and } below it, so enter only the body. This is a minimal example, so test it on your site:

if (options.isActive) return;
function onExit(e) {
  if (e.clientY <= 0) {
    document.removeEventListener('mouseout', onExit);
    activate();
  }
}
document.addEventListener('mouseout', onExit);

Advanced location settings with the trigger set to When a callback is called and the exit-intent snippet in the Callback JavaScript box

The variation then runs only for visitors who show exit intent. Its code should show the pop-up right away, because the exit intent has already happened. A Custom Pop-up with the Load trigger would not open in this setup, because the element finished loading before the experience activated.

For more callback examples, see Targeting Experiments with Dynamic Location Triggers (JS Callbacks).

Example: testing an exit-intent pop-up using JavaScript

Convert allows you to add JavaScript or HTML to specific variations in an A/B experiment, which makes it possible to test custom components such as exit pop-ups.

We decided to choose an open-source Exit-Intent Popup that is freely available for anyone use. We do not endorse, guarantee, or recommend the linked software. We only show it for demonstration purposes.

Firstly, we create a Convert AB Experiment. Then, while in the Visual Editor, we open our Variation JS editor:

s61

Then copy the minified Exit Intent Pop Up minified javascript code in the editor. After that add the template code. Then apply the changes and save it.

You can have a preview of your variation with the Live Preview.

Your page where you created will show. Try to navigate out of it, and your popup will show:

s62
You can customize the code to your desire. 

Summary

  • Custom Pop-ups open on a click, a scroll or a load. They have no exit-intent trigger.
  • To test an exit-intent pop-up, add custom JavaScript to a variation.
  • To count only visitors who show exit intent, activate the experience from a location callback.
  • Treat exit pop-ups as experiments, not just UI elements.

By testing exit-intent pop-ups with the same discipline as any other experiment, you can validate interruption-based UX decisions with confidence.