npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

dont-bounce-please

v2.0.2

Published

Allows programmer-specified behavior upon detection of a likely bounce. Exposes a single method `DBP` which can take in a options object or a method to be run upon bounce.

Downloads

7

Readme

Don't Bounce Please

A small, modern and easy to use library to detect bouncing users.

Unlike other solutions, Don't Bounce Please can detect departing mobile users on iOS and Android!

We provide 3 techniques to capture all types of users - mobile or desktop - and display a "please don't leave" type message. As far as this author is aware, the combination of techniques applied is unique among open source implementations of bounce detectors and provides the best coverage of users' devices available.

You'll find a discussion of how to use bounce overlays to reduce your bounce rate here: https://inbound.org/discuss/do-popup-overlays-ever-decrease-your-bounce-rate

Usage

Include jQuery > 1.6 and DBP in your website with script tags that look like this:

<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script>
<script type='text/javascript' src='../../DBP-1.0.1.js'></script>

Then call the new function DBP with an argument of what you want to do prior to detecting a bounce.

DBP(function() {
  alert("Please don't go!");
});

The DBP method takes either a function to run upon bounce as its first argument or an object with any options you wish to specify. Here's the defaults list:

const defaultOptions = {
  method: 'auto', // the method used "auto", "mouseout", "history" or "blur".
  showPerPage: 1, // the maximum number of times to trigger per page
  showPerUser: undefined, // the maximum number of times to trigger per user (cookie based)
  cookieName: 'dbp',

  // mouseout detector settings
  distance: 100, // minimum distance from the top the user must have exited the window to trigger.
  sensitivity: 10, // minimum distance the mouse must have moved lately to trigger.
  scrollDelay: 500, // ms to wait after scrolling before mouseout will register.

  onlySameReferrer: false, // only show if the referrer is the same domain (user has been on site)
  notSameReferrer: false, // only show if the referrer is not the same domain (user just came in)

  onBounce: () => {
    console.log('bounce');
  }, // the default onBounce handler
};

For example, you could use the following to only display an exit popup once and only to users who are leaving the site straightaway (not referred from somewhere else on your domain):

DBP({
  showPerUser: 1,
  notSameReferrer: true,
  onBounce: function() {
    alert("Please don't go!");
  },
});

By default, the method "auto" is used, which applies a mouseout detector on desktop (which checks if the user's mouse leaves the top of the screen towards the browser chrome) and a history and blur based detector on mobile (which pads the user's history and monitors for blur events on the whole page to detect leaving).

Example

Bounce-time exit popup

Development

Please run eslint on any code in your pull requests. Out of the box, npm build will create the dist/ direcotry and npm dev will put Webpack in watch mode for any changes (rebuilding upon detection of a change).