Code Monkey home page Code Monkey logo

exit-intent-popup's Introduction

exit-intent-popup

Features

  • Fully customizable via HTML and CSS.
  • Can use third party forms to collect emails.
  • Support for embeddable CSS fonts, including Google Fonts.
  • Cookie support with optional expiry date.
  • Set a timed delay before the script starts tracking exit intent.
  • Display popup based on exit intent or timed delay.
  • Scales to adjust to window size.

Usage

Simply include the script and call its init function with any options you choose. You must add in your own HTML otherwise the popup will be blank.

<script type="text/javascript" src="bioep.min.js"></script>

<script type="text/javascript">
    bioEp.init({
        // Options
    });
</script>

You can also add HTML and CSS directly on the page. The popup element you wish to use must have an id of bio_ep.

<head>
    <script type="text/javascript" src="bioep.min.js"></script>

    <script type="text/javascript">
        bioEp.init({
            // Options
        });
    </script>
    
    <style type="text/css">
        #bio_ep_bg {} // background
        #bio_ep {} // popup
        #bio_ep_close {} // close button
	</style>
</head>
<body>
    <div id="bio_ep">
        <!-- your popup HTML goes here -->
    </div>
</body>

Template

Using HTML and CSS

bioEp.init({
	html: '<div id="bio_ep_content">' +
		'<img src="http://beeker.io/images/posts/2/tag.png" alt="Claim your discount!" />' +
		'<span>HOLD ON!</span>' +
		'<span>Click the button below to get a special discount</span>' +
		'<span>This offer will NOT show again!</span>' +
		'<a href="#YOURURLHERE" class="bio_btn">CLAIM YOUR DISCOUNT</a>' +
		'</div>',
	css: '#bio_ep {width: 400px; height: 300px; color: #333; background-color: #fafafa; text-align: center;}' +
		'#bio_ep_content {padding: 24px 0 0 0; font-family: "Titillium Web";}' +
		'#bio_ep_content span:nth-child(2) {display: block; color: #f21b1b; font-size: 32px; font-weight: 600;}' +
		'#bio_ep_content span:nth-child(3) {display: block; font-size: 16px;}' +
		'#bio_ep_content span:nth-child(4) {display: block; margin: -5px 0 0 0; font-size: 16px; font-weight: 600;}' +
		'.bio_btn {display: inline-block; margin: 18px 0 0 0; padding: 7px; color: #fff; font-size: 14px; font-weight: 600; background-color: #70bb39; border: 1px solid #47ad0b; cursor: pointer; -webkit-appearance: none; -moz-appearance: none; border-radius: 0; text-decoration: none;}',
	fonts: ['//fonts.googleapis.com/css?family=Titillium+Web:300,400,600'],
	cookieExp: 0
});

Using an image

bioEp.init({
	width: 394,
	height: 298,
	html: '<a href="#YOURURLHERE" title="Claim your discount!"><img src="http://beeker.io/images/posts/2/template2.png" alt="Claim your discount!" /></a>',
	cookieExp: 0
});

Options

All options must be added to the init function as an object.

Name Type Default Description
width integer 400 The width of the popup. This can be overridden by adding your own CSS for the #bio_ep element.
height integer 220 The height of the popup. This can be overridden by adding your own CSS for the #bio_ep element.
html string blank The HTML code to be placed within the popup. HTML can be added through this function or on the page itself within a element.
css string blank The CSS styles for the popup. CSS can be added through this function or on the page itself.
fonts array null An array containing URLs that link to font stylesheets. Google Fonts was the main idea behind this feature.
delay integer 5 The time, in seconds, until the popup activates and begins watching for exit intent. If showOnDelay is set to true, this will be the time until the popup shows.
showOnDelay boolean false If true, the popup will show after the delay option time. If false, popup will show when a visitor moves their cursor above the document window, showing exit intent.
cookieExp integer 30 The number of days to set the cookie for. A cookie is used to track if the popup has already been shown to a specific visitor. If the popup has been shown, it will not show again until the cookie expires. A value of 0 will always show the popup.
showOncePerSession boolean false If true, the popup will only show once per browser session. If false and cookieExp is set to 0, the popup will show multiple times in a single browser session.
onPopup function null A callback function to be called when the popup is displayed in the browser.

License

MIT license, feel free to use however you wish!

Created by beeker.io

exit-intent-popup's People

Contributors

artis101 avatar beeker1121 avatar spencerbrooks avatar strangewill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exit-intent-popup's Issues

Cookie Expiration

Hi Ma'am/Sir

How can I set the cookie expiration every 30 minutes?.

Popup now triggering when mousing over the scrollbar

The latest updates have introduced a bug that triggers the popup when there is a mouseover of a scrollbar on the page. I had to revert back to the version checked in on 11/21 in order to find a version working properly.

Download opens twice

Since we updated to the new JS, we have that problem that downloads opens twice. This not happens every time. Tested on OSX with Chrome and FF

Allow popping once per session

I believe that if you change the code to:
line 27: if(days && days > 0) { /* added && days > 0 */

line 61: if(this.cookieExp < 0) { /* replaced <= with < */

then setting cookieExp to 0 would mean once per session, while -1 would mean every time the page loads.

Replace close icon

Hi do you know if it's possible to use from fontawesome as a close icon? Thanks for your feedback

not working for IE 11

tried the preview. works great in chrome, but not in IE (edge was fine too). Any workaround so that IE can function similarly?

Can paste in other scripts for the popup

Hi Thanks for this. I am trying to paste in javascript code for a survey in the popup and it does not ever show up. even when I escape the beginning and ending script tags. Is there a workaround for this?

Here is the code I am trying to paste in:

bioEp.init({ width: 500, height: 500, html: '<div id="bio_ep_content">' + '<script>' + '(function(t,e,n,o){var s,c,a;t.SMCX=t.SMCX||[],e.getElementById(o)||(s=e.getElementsByTagName(n),c=s[s.length-1],a=e.createElement(n),a.type="text/javascript",a.async=!0,a.id=o,a.src=["https:"===location.protocol?"https://":"http://","widget.surveymonkey.com/collect/website/js/Ba1lnQm_2FNYvZAGHkhU85JlWZ_2FT_2FztMmG1aFooyX1_2Ft5zu_2BT0CMg94fD0n5defRkk.js"].join(""),c.parentNode.insertBefore(a,c))})(window,document,"script","smcx-sdk");' + '</' + 'script>' + '</div>', cookieExp: 0 });

Pop-Up not Scaling and Not in Center of the Page on iOS .

Hi,
Thanks for this excellent script. The issue is on checking the script on iOS devices, (checked in iPhone 6 and 4S) , And the free simulator https://appetize.io/demo . The issue is I believe something do with the Transform Matrix but could not get any more idea. The pop-up is displayed at the bottom right of the page and displays only the top left part of the popup. I have attached a screen shot of this taken from the Appetize.io simulator.
2015-08-06 09-20-17 screenshot

Thanks

Popup shown initial fix

Hi,

the popup is shown, when the page is loaded.

$(document).ready(function () {
bioEp.init(); }

To fix this I've added a class=hide to the div.

$(document).ready(function () {
var hidePopup = $(".hide");
bioEp.init();
hidePopup.removeClass("hide"); }

CSS:
.hide {display:none;}

Just want to clarify if I've put the bioep.init(); in the wrong place or this is an improvement.

Hovering over a form field's "autocomplete" menu triggers popup

Issue: If someone is filling in a form and their browser shows previously filled entries and the user hovers over one of them, the popup triggers (as it thinks the person has left the browser window).

Problem seen in

  • Firefox

Can't reproduce in

  • Chrome
  • Safari

callback function would be awesome

a callback function would be awesome, for things like (Google Analytics) event tracking of the showPopup and hidePopup functions.

Great work!

IE10 document.body null within domReady

In IE10 and below (compat modes in IE11) I get an error:

SCRIPT5007: Unable to get property 'appendChild' of undefined or null reference
File: bioep.js, Line: 115, Column: 3

which is for this line which gets triggered from your domReady function:

document.body.appendChild(this.bgEl);

This happens with the demo as well as my code, and I'm guessing this is an issue with document.readyState?
Is IE10 supported?

Firefox triggering exit intent when http warning message in e-mail field

As you can see from the picture. When you hover over THE CORNERS of it, it triggers the exit intend. That's not correct. But somehow it is realy just triggering at some pixels of that http window. The autocomplete dropdown is working properly. I'm on Ubuntu 15 by the way. Is this also possible to fix in the future?

grafik

You already fixed a very similar issue here: #20

I'm sure it's not that hard. Someone knows?

Issue also exists in the https://github.com/carlsednaoui/ouibounce project.

Ability to remove 'X' in close button

The X in the close button looks like it is being injected into the DOM via the script. Is there any way this can be disabled, as I would rather use a font icon library such as Font Awesome.
Thanks

Create release tag

Would it be possible that you make a release tag, so it is possible to address a certain tag when including exit-intent-popup in a project?

"cookieExp: 0" not working?

Hey,

when the option " cookieExp: 0" is on... the popup is shown everytime where it was included (but without black background).
Do you know why?

Many regards
Paul

Trigger popup on different event

Is there any way to trigger the popup using a different event (in addition to the exit intent)? For example, clicking a link would also trigger the popup?

If the user navigates around on the website and e.g. leaves window on 3rd page, the cookie already exists and there is no popup

I noticed that the cookie is always set, even if the mouse never leaves this window. As a result the popup only ever show while on the first page. If the user navigates around on the website and e.g. leaves window on 3rd page, the cookie already exists and there is no popup. How can I change this?

i don't want to put cookieExp option to 0, because it will fire on every page, i don't want to popup shows on every page load.
how can i solve this issue??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.