Leave tracker for a website: how to catch the moment your customer is leaving

Our usual customer flow includes five steps:

  1. Upload
  2. Configuration
  3. Quote
  4. Billing
  5. Overview

But what if the client has fifty files, or five hundred?

It would take quite a long time. Because of the complicated process of calculation, and additional services we use to do this. Services emulate the process of developing details on factories to figure out the most optimal way to place parts on sheet metal.

Tech Part

Now, let’s speak about the technical part. Based on these manipulations you will have the possibility to catch a moment when the user tries to leave the page.

How does it work?

The system sends your request at a browser level, instead of a page level. That gives us the possibility not to slow down the transition between pages, and also be sure that the request will be done, even if the tab would be closed.

What about browser support?

All modern browsers support Beacon API, the only problem could occur with Internet Explorer 11 support, but fortunately, we do not use it anymore.

How does it look in the code?

We create a function with a server-side request, where we use sendBeacon.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store