Increase your landing page conversion rates.

Related tags

CSS ouibounce
Overview

Ouibounce

Originally created by Carl Sednaoui from MailCharts. Maintained and improved by generous contributors.

tests twitter

Ouibounce: A small library enabling you to display a modal before a user leaves your website.

Quick note: Let me know if you end up using Ouibounce. I'd love to hear about your project / see Ouibounce in the wild :)

The philosophy behind this project

This library helps you increase landing page conversion rates. From my experience, you can expect a lift of 7% to 15% depending on your audience, traffic type (paid or unpaid) and copy.

Talking about copy... please use Ouibounce to provide value to your visitors. With tools like these it's very easy to create something spammy-looking.

Not sure what I mean by provide value? Here are a few ideas to get your creative juices flowing:

Demo / Examples

Modal inspiration

I've designed a few modals just for you. Feel free to use these as inspiration.

fancy with content fancy no header simple simple with book simple with feedback

Installation

You have a few options to choose from:

  • Download the minified or unminified script and include it on your page
  • Get Ouibounce from cdnjs.com
  • Use Bower: curl http://bower.herokuapp.com/packages/ouibounce
  • Use NPM: npm install ouibounce

Note: Ouibounce is wrapped by a umd wrapper, so if you are using requirejs/amd or commonjs/browserify, it will still work fine.

Usage

  1. Create a hidden modal
  2. Select the modal with vanilla JavaScript (or jQuery) and call ouibounce
  3. Optional: Save the function's return value to use the public API, allowing you to fire or disable Ouibounce on demand

Example:

ouibounce(document.getElementById('ouibounce-modal'));

Example with jQuery:

ouibounce($('#ouibounce-modal')[0]);

Example using the public api:

var modal = ouibounce(document.getElementById('ouibounce-modal'));
modal.fire()

Options

Ouibounce offers a few options, such as:

Sensitivity

Ouibounce fires when the mouse cursor moves close to (or passes) the top of the viewport. You can define how far the mouse has to be before Ouibounce fires. The higher value, the more sensitive, and the more quickly the event will fire. Defaults to 20.

Example:

ouibounce(document.getElementById('ouibounce-modal'), { sensitivity: 40 });
Aggressive mode

By default, Ouibounce will only fire once for each visitor. When Ouibounce fires, a cookie is created to ensure a non obtrusive experience.

There are cases, however, when you may want to be more aggressive (as in, you want the modal to be elegible to fire anytime the page is loaded/ reloaded). An example use-case might be on your paid landing pages. If you enable aggressive, the modal will fire any time the page is reloaded, for the same user.

Example:

ouibounce(document.getElementById('ouibounce-modal'), { aggressive: true });
Set a min time before Ouibounce fires

By default, Ouibounce won't fire in the first second to prevent false positives, as it's unlikely the user will be able to exit the page within less than a second. If you want to change the amount of time that firing is surpressed for, you can pass in a number of milliseconds to timer.

Example:

ouibounce(document.getElementById('ouibounce-modal'), { timer: 0 });
Delay

By default, Ouibounce will show the modal immediately. You could instead configure it to wait x milliseconds before showing the modal. If the user's mouse re-enters the body before delay ms have passed, the modal will not appear. This can be used to provide a "grace period" for visitors instead of immediately presenting the modal window.

Example:

// Wait 100 ms
ouibounce(document.getElementById('ouibounce-modal'), { delay: 100 });
Callback

You can add a callback, which is a function that will run once Ouibounce has been triggered, by using the callback option.

Example:

ouibounce(document.getElementById('ouibounce-modal'), { callback: function() { console.log('Ouibounce fired!'); } });
Cookie expiration

Ouibounce sets a cookie by default to prevent the modal from appearing more than once per user. You can add a cookie expiration (in days) using cookieExpire to adjust the time period before the modal will appear again for a user. By default, the cookie will expire at the end of the session, which for most browsers is when the browser is closed entirely.

Example:

ouibounce(document.getElementById('ouibounce-modal'), { cookieExpire: 10 });
Cookie domain

Ouibounce sets a cookie by default to prevent the modal from appearing more than once per user. You can add a cookie domain using cookieDomain to specify the domain under which the cookie should work. By default, no extra domain information will be added. If you need a cookie to work also in your subdomain (like blog.example.com and example.com), then set a cookieDomain such as .example.com (notice the dot in front).

Example:

ouibounce(document.getElementById('ouibounce-modal'), { cookieDomain:
'.example.com' });
Cookie name

You can specify cookie name passing cookieName: 'customCookieName'.

Example:

ouibounce(document.getElementById('ouibounce-modal'), { cookieName: 'customCookieName' });
Sitewide cookie

You can drop sitewide cookies by using passing sitewide: true.

Example:

ouibounce(document.getElementById('ouibounce-modal'), { sitewide: true });
Chaining options

The options are just javascript objects, you can therefore combine multiple options.

Example:

ouibounce(document.getElementById('ouibounce-modal'), {
  aggressive: true,
  sitewide: true,
  cookieDomain: '.example.com',
  timer: 0,
  callback: function() { console.log('ouibounce fired!'); }
});

Ouibounce API

If you save the object returned by the ouibounce function, you get access to a small public API. Use this API to fire or disable Ouibounce on demand.

Example:

var modal = ouibounce(document.getElementById('ouibounce-modal'));
modal.fire(); // fire the ouibounce event
modal.disable() // disable ouibounce, it will not fire on page exit
modal.disable({ cookieExpire: 50, sitewide: true }) // disable ouibounce sitewide for 50 days. 
Disable options

The disable function accepts a few options:

Using Ouibounce with other libraries

If you want to use this library with other plugins — such as Vex — you can call ouibounce with false. See #30 for discussion.

var _ouibounce = ouibounce(false, {
  callback: function() { console.log('ouibounce fired!'); }
});
Twitter Bootstrap

If you're trying to use Ouibounce with Twitter Bootstrap and are simply copying the example code I've included in the demo, you might run into some problems. See #66 to fix this.

Legacy JS engines

If you'd like Ouibounce to work in legacy JS engines (IE8 and below, for example), you'll need to add a shim such as es5-shim.

WordPress

Tomaž wrote a great tutorial on how to build your own WordPress opt-in form.

Kevin Weber wrote wBounce, a WordPress plugin. I personally have not tested it, but have heard it works really well. Check it out.

Miscellaneous

Analytics

Comments
  • Modal appears when entering page rather than leaving

    Modal appears when entering page rather than leaving

    Chrome 35.0.1916.114 m

    1. Open demo page in new tab
    2. Move mouse to tabs, go right to click on newly opened tab
    3. Move mouse down into page (out of browser chrome)
    4. Modal is triggered
    5. Refresh page by clicking the "refresh" icon, or by highlighting the URL and pressing enter (i.e. entering browser chrome)
    6. Move mouse back down into page (out of browser chrome)
    7. Modal is triggered

    Is mouseleave supported? http://www.quirksmode.org/dom/events/mouseover.html#t05

    If that's not the problem, maybe you need to detect the movement direction (i.e. save each e.clientY on movement and compare against it on trigger)? Similar detection in https://github.com/kamens/jQuery-menu-aim

    opened by zaus 21
  • Cookies tracking page not site

    Cookies tracking page not site

    Is it be possible to change the cookies to affect the whole site and not only the page it was on? If a user exits the popup, I don't want them to see it for 5 days sitewide, not just on that page.

    Thanks!

    opened by mcg88 14
  • Exit Intent

    Exit Intent

    This is a brilliant alternative. But shouldn't this behave like bounceexchange where it captures exit intent, and not enter intent? How come all the demos ive seen on your site plus all other live sites has the code executed upon entry? Kind of defeats the purpose. Looks super spammy because it fires upon entry and makes me click X.

    opened by jameskkv 9
  • Twitter Bootstap Issue

    Twitter Bootstap Issue

    Hi,

    We prepare a page and use ouibounce. We make every detail just same as examples. Modal open but we can't see. (We test it, when we inactive twitter bootstrap it work but when we use twitter bootstrap it won't work)

    How can we fix that?

    opened by muhammedtufekyapan 8
  • No issue...just kudos!

    No issue...just kudos!

    I really like this script! It works wonders.

    I noticed that some comments here were about folks wanting Twitter Bootstrap compliance.

    Just as a token of appreciation and, of course, kudos to the creator, I created something for everyone:

    Here's a free Bootstrap iteration with two demo styles!

    No big deal...but it does have two styles which have proven to be highly converting in the wild.

    Some of the issues I've included are centering modals horizontally and vertically, opening one modal over another, pure bootstrap (except for a custom close button), high converting 'two choice' buttons, and more.

    I hope everyone who sees this enjoys!

    And thanks for creating the core code.

    opened by marketbizpro 7
  • Ouibounce is not being fired on production

    Ouibounce is not being fired on production

    Hi, Ouibounce is not being fired on my single-page application: http://onrocket.com.br. When I try it in localhost mode (index.html file) it works. Any hints?

    opened by fabiosl 7
  • Incorrect behaviour when entering <html> (instead of leaving)

    Incorrect behaviour when entering (instead of leaving)

    If you load the page when the mouse pointer is still in the bar of the browser (say, on the address field) and after the page is loaded you moved the mouse onto the page to start looking at the website (as you do), the modal will get activated (at least that's the behavior in Chrome Version 34.0.1847.116 m on Windows 7). I think instead of mouseout, mouseleave should be used.

    opened by s16h 7
  • Allow timed delay which is cancelled by the mouse re-entering. Fixes #48.

    Allow timed delay which is cancelled by the mouse re-entering. Fixes #48.

    This feature allows developers to provide a "grace period" where the mouse may leave the body for a short time without immediately triggering the modal - it will only appear if the mouse does not re-enter after delay ms.

    This new feature also fixes issue #48. When you mouse into the page from the toolbar, Windows Chrome 35+ seems to trigger these events in quick succession:

    mouseenter
    mouseleave
    mouseenter
    

    That middle mouseleave would normally cause the modal to appear; however, due to the new feature, the subsequent mouseenter will cancel that timer and thus the modal won't appear. (This even works if delay is set to 0)

    This fixes issue #48 for me on Windows 7 64-bit Chrome 36.0.1985.103 beta-m.

    opened by colinodell 6
  • Idea: Show modal only when mouse cursor is not in the viewport

    Idea: Show modal only when mouse cursor is not in the viewport

    I'm reading the comments on Hacker News (https://news.ycombinator.com/item?id=7815324). Some people seem to not approve with the current behavior of your script.

    I've posted an idea. I'm copy-pasting it here:

    How about this: The modal shows up when you move the mouse out of the viewport (e.g. via the top edge), but then the modal closes immediately once the mouse cursor enters the viewport again. So, as long as (and only when) the mouse is above/outside the viewport, the modal is displayed. Also, the modal doesn't have any buttons or fields. It's just displayed for informative purposes, e.g. to inform the user about a site update, or to point out a site feature.

    I think, this would be a good enhancement. You could add this behavior via an option, e.g. "hide on re-enter".

    opened by simevidas 6
  • Use ouibounce without dummy object?

    Use ouibounce without dummy object?

    I want to have full control over what happens on exit (my own modal code, etc).

    Right now I have to just make a dummy object, and put my regular code in the callback. Maybe we could just have something like calling ouibounce() on false will still trigger callbacks but wont try to mess with any elements?

    opened by 9mm 6
  • Questions

    Questions

    First off, thanks for this awesome library. I'm using it for a project and have amended ouiBounce so that the modal will activate when a user leaves from any side of the window.

    I'm somewhat new to programming so I have a few question: some might have longer answers than other so feel free to only answer the ones you have time for.

    1. what do the first few lines do (function(root, factory) ... )? You mentioned that it is a UMD wrapper. Do you know of a good article that explains the basics of UMD?

    2. You chose mouseout as the event that your watching. Why didn't you choose mousemove?

    3. I want to contribute to ouiBounce, or at least publish my amendments, but I'm not sure what things like gulp are. I visited the site but it didn't clarify much for me.

    Thanks,

    Bez

    opened by bezreyhan 6
  • Unable to access ouibounce function in a static .js file

    Unable to access ouibounce function in a static .js file

    Hi,

    I am trying to use this library in a snippet code that is hosted as a static .js file in a cdn share.

    this script is imported by several other 3rd party websites.

    I am using the below code in the static .js file.

    // ouibounce script load var ouibounceScript = document.createElement("script"); ouibounceScript.src = "https://cdnjs.cloudflare.com/ajax/libs/ouibounce/0.0.12/ouibounce.js"; document.head.appendChild(ouibounceScript);

    var modal = ouibounce(document.getElementById("widget-view")); modal.fire();

    However this is throwing me an error stating ouibounce is not defined

    Can you please help?

    Thanks.

    opened by chakanish 0
  • ouibounce is used on donaldjtrump.com

    ouibounce is used on donaldjtrump.com

    Not an issue, more of an observation....

    ouibounce is used on donaldjtrump.com, funny thing about it is that it's the vulnerability on the site because it's a direct embed of https://carlsednaoui.github.io/ouibounce/build/ouibounce.min.js.

    You could literally do an update to ouibounce and have control of donaldjtrump.com. The rest of the site is all locked down through multi-proxies and security companies... but somehow this library is clear and openly available there, haha.

    Please make that happen!

    opened by nicetransition 0
  • Ouibounce script working irregularly

    Ouibounce script working irregularly

    Please let me know if anybody can help me with the below issue:

    I have used the ouibounce script on my website but it is not working properly. On some devices, it is working fine but on some devices, the popup is not appearing. I have tried it on different browsers also but it is showing this irregular behavior with the browsers also.

    Any help will be appreciated.

    opened by ritugodiyal04 0
  • using ouibounce with a 3rd party script, won't show

    using ouibounce with a 3rd party script, won't show

    My 3rd party exit panel doesn't show while using the ouibounce modal when adblock is present.

    https://sputteringmidsize.com/index.php?t202kw=t202kw&clickid=c1&pubid=c2&isplit=c3&wsplit=c4&c5=c5&c6=c6&c7=c7&subindex=I10&i=1245&t=n

    Only works when adblock is disabled. Any way around this?

    opened by dodgerdog05 1
  • Sensitivity not triggering

    Sensitivity not triggering

    The sensitivity option has no effect on any browser I've tested on. I'm wondering if this has to do with the fact that we're using the mouseleave event on HTML? If it only fires when the mouse has already left how are we able to increase sensitivity? Or possible I am misunderstanding the meaning of the sensitivity option.

    I was able to fix this by using the 'mousemove' event (and keeping track of clientY so that I could ensure the mouse is moving generally upwards and not downward).

    opened by bacoords 0
Releases(v0.0.12)
Owner
Carl Sednaoui
Director of Marketing at MailCharts.com
Carl Sednaoui
coala Landing Page - https://gitlab.com/coala/landing is needed as backend

landing-frontend coala Landing Page - https://gitlab.com/coala/landing is needed as backend Usage To run locally: $ git clone https://github.com/coala

coala development group 31 Oct 30, 2022
A responsive, Bootstrap landing page template created by Start Bootstrap

Start Bootstrap - Landing Page Landing Page is a multipurpose landing page template for Bootstrap created by Start Bootstrap. Preview View Live Previe

Start Bootstrap 1.4k Jan 3, 2023
Minimal landing page for developers

Dev Landing Page Minimal landing page for developers. Developers don't talk much. Their code does all the talking. So here's a minimal landing page fo

Dinesh Pandiyan 1.2k Jan 4, 2023
Esri GitHub landing page

esri.github.io Landing page for Esri open source projects. Both the project categories and search suggestions in http://esri.github.io are powered by

Esri 470 Dec 31, 2022
Tailwind CSS Starter Template - Landing Page

Tailwind Toolbox - Landing Page Template Landing Page is an open source, generic landing page template for Tailwind CSS created by Tailwind Toolbox. G

Tailwind Toolbox 908 Jan 8, 2023
A web app landing page theme created by Start Bootstrap

Start Bootstrap - New Age New Age is a web app landing page theme for Bootstrap created by Start Bootstrap. Preview View Live Preview Status Download

Start Bootstrap 996 Dec 26, 2022
Landing page starter

?? Fresh Fresh is a free landing page starter built by cssninjaStudio. ✌️ preview Check out the live demo by clicking here. Fresh is built with Bulma

cssninja 486 Dec 23, 2022
Startup Landing Page Components for React.js

neal-react neal-react is a collection of reactjs components to quickly build landing pages. I found that using hosted services like Launchrock doesn't

Denny Britz 1.4k Nov 30, 2022
🖼 A pure client-side landing page template that you can fork, customize and host freely. Relies on Mailchimp and Google Analytics.

landing-page-boilerplate A pure client-side landing page template that you can freely fork, customize, host and link to your own domain name (e.g. usi

Adrien Joly 129 Dec 24, 2022
Serverless Pre-Rendering Landing Page

Serverless Pre-Rendering Demo Read the blog post Checkout the demo Developing By default, the content on the site is based off our public Notion page.

Vercel 389 Dec 21, 2022
🎉 Personal landing page template

Landing Page Personal landing page template. Designed to keep simplicity in mind in both setup and UI. Stack HTML CSS Font Awesome Themes Couple custo

Madza 77 Dec 22, 2022
FREE Bootstrap Landing Page Template for Developers and Startups

Theme Details & Demo Details: https://themes.3rdwavemedia.com/bootstrap-templates/startup/appkit-landing-free-bootstrap-theme-for-developers-and-start

Xiaoying Riley 158 Nov 30, 2022
a Plex landing page that redirects you to various sites.

PlexRedirect a Plex landing page that redirects you to various sites. Blank spaces are where your server name goes. If you don't have a server name yo

null 222 Dec 29, 2022
Projeto responsivo, que simula uma Landing Page de uma site de turismos.

FlexTurismos Projeto responsivo, que simula uma Landing Page de um site de turismos. Tecnologias utilizadas: Site com a tela interia Click aqui para a

Ricardo 1 Jan 29, 2022
Ta-vivo Landing page

Ta-vivo landing page Getting Started Prerequisites Node.js 12+ (versions below could work, but are not tested) Installing Clone the repository Install

Ta-vivo 6 Oct 10, 2022
A Unique Food order landing page web application called 'HOMELY' where you can select available meals and add them to cart then order them.

End Result Click the link : https://foodapp-by-eniola.netlify.com Getting Started with Create React App This project was bootstrapped with Create Reac

Eniola Odunmbaku 26 Dec 31, 2022
:mountain_bicyclist: Landing Pages of Ant Design System

Ant Design Landing Landing Pages of Ant Design System English | 简体中文 What is Landing? Landing is a template built by Ant Motion's motion components. I

Ant Design Team 5.2k Dec 31, 2022
A responsive HTML template for coding projects with a clean, user friendly design. Crafted with the latest web technologies, the template is suitable for landing pages and documentations.

Scribbler - a responsive HTML template for coding projects and documentations Scribbler is a responsive HTML/CSS/Javascript template designed for deve

Amie Chen 394 Jan 1, 2023
A service to add web page screenshots to your Eleventy sites.

Screenshot API A runtime service to use live website screenshots on your site. Usage Image URLs have the formats: https://v1.screenshot.11ty.dev/:url/

Eleventy 91 Dec 24, 2022