Person at laptop with cursor moving toward browser close button

Exit Intent Tracking: How to Detect When Visitors Are About to Leave

Most of your website's visitors leave without taking any action. Understanding why — and being able to identify the exact moment a visitor switches from engaged to departing — is one of the more powerful capabilities in modern web analytics. Exit intent tracking is the practice of detecting behavioral signals that indicate an imminent page departure and using that information either to intervene in real time or to diagnose abandonment patterns after the fact.

What Signals Indicate Exit Intent

Exit intent is inferred from behavioral signals rather than observed directly. No JavaScript event fires when a visitor makes the cognitive decision to leave — you can only observe the physical actions that tend to precede departure.

Implementing Exit Intent Events

To track exit intent in your analytics as a measurable event, add this to your page JavaScript:

let exited = false;
document.addEventListener('mouseleave', (e) => {
  if (e.clientY <= 0 && !exited) {
    exited = true;
    _st('event', 'exit_intent', 'engagement', document.title);
  }
});

This fires once per page load when the cursor exits through the top of the viewport, recording which page the visitor was about to leave.

Combine this with your existing scroll depth data to understand whether visitors who trigger exit intent have actually read the page or are leaving before engaging with the content at all.

Using Exit Data to Diagnose Abandonment

The diagnostic value of exit intent data comes from comparing pages. If 60% of visitors on your pricing page trigger exit intent without converting, but only 20% do so on your features page, the pricing page has a problem that the features page does not — likely a mismatch between the visitor's expectations and what they find at that stage.

Segment your exit intent events by traffic source. Paid traffic that exits at high rates from your landing pages is traffic that was mis-targeted — the ad copy set expectations the page did not deliver. Organic traffic that exits from the same pages at lower rates suggests the problem is the ad creative, not the page.

Look at the sequence of pages that precede high-exit-intent pages using page flow analysis. If visitors consistently exit from page C after visiting pages A then B, the transition from B to C is a friction point — either the link is misleading about what page C contains, or page C fails to deliver on the context set by page B.

Track abandonment signals with statpx custom events

statpx custom events let you log exit intent, idle timeouts, and back-button presses so you can see exactly where your site loses visitors and why.

Start for free →

The Bottom Line

Exit intent tracking transforms departing visitors from a lost statistic into a diagnostic signal. By capturing the behavioral patterns that precede page abandonment — upward mouse movement, back-button presses, rapid scanning — you can identify which pages lose visitors earliest, which traffic sources send visitors who leave before engaging, and where your content or user experience fails to hold attention. The data will not fix those problems for you, but it will tell you precisely where to look and which changes to prioritize.

Continue reading

Technical
How to Identify and Block Referrer Spam in Website Analytics
Technical
How to Filter Your Own Visits Out of Website Analytics
Technical
Custom Dimensions in Analytics: Track Extra Context Beyond Pageviews
Analytics by statpx