1.0.1 • Published 9 years ago
Exitent v1.0.1
Exitent
Exitent is a light-weight Exit Intent detection library. Use Exitent to detect if someone is leaving your site and will fire several events.
Installation
The library may be installed from NPM using the following command:
npm install --save Exitent
Or, if you would rather -- it may be included directly inline within your HTML document.
<script src="./dist/exitent.min.js></script>Default Configuration
{
'threshold': 50,
'maxDisplays': 1,
'eventThrottle': 500,
'checkReferrer': true,
'storageName': 'exitent-visited',
'storageLife': 7,
'preExitent': null,
'onExitent': null,
'postExitent': null
}thresholdmaximum distance in pixels from the top of the page to consider triggering for.maxDisplaysthe maximum number of times the event(s) may be triggered on a page.eventThrottlethe amount of time to wait in milliseconds to invoke the handler responsible for scroll events.checkReferrerwhether or not to check the referring page to see if it's on the same domain and this isn't the first pageview.storageNamethe name/key to store the localStorage item (or cookie) under.storageLifethe expiration in days of the localStorage item (or cookie).preExitentfunction to call when before an exit intent has been detected. This accepts no arguments since none are necessary.onExitentfunction to call when an exit intent has been detected. This accepts no arguments since none are necessary.postExitentfunction to call when after an exit intent has been detected. This accepts no arguments since none are necessary.
API Methods
constructor
Initialise your Exit Intent detection with specified user options.
Parameters
optionsobject a configuration option defining the settings for exit detection.
Example
var e = new Exitent({
'threshold': 10,
'maxDisplays': 3,
'checkReferrer': false,
'onExitent': function() {
console.log('Exit Intent Detected')
}
});