exit-intent-quattro

    1.4.0 • Public • Published

    Exit Intent Quattro

    version MIT License Standard Standard Version Size Size gzip

    Exit Intent detection library based on Dan Hayden's original version. This library builds on top of the original version by adding edge detection on all 4 edges of the viewport instead of just the top.

    Usage

    import exitIntent from 'exit-intent-quattro';
    
    // Initialise
    const removeExitIntent = exitIntent({
      edges: {
        top: true,
        right: true,
        bottom: true,
        left: true,
      },
      threshold: 20,
      maxDisplays: 2,
      eventThrottle: 100,
      onExitIntent: ({side, position: {x, y}}) => {
        console.log(`exit-intent triggered on ${side} side at position ${x}, ${y}`);
      },
    });
    
    // Destroy
    removeExitIntent();

    Options

    edges (default {top: true, right: false, bottom: false, left: false})
    edges of the viewport that triggers exit intent.

    threshold (default 20)
    maximum distance in pixels from the top of the page to trigger.

    maxDisplays (default 1)
    maximum number of times to trigger.

    eventThrottle (default 200)
    event throttle in milliseconds.

    onExitIntent (default no-op function)
    function to call when an exit intent has been detected. An object will be passed in with these properties (see example above):

    • side
      • string with possible values: top, right, bottom, and left
    • position
      • object with x and y numeric properties indicating the position at which exit intent was detected

    License

    MIT

    originally based on https://github.com/richriscunha/Exitent

    Keywords

    Install

    npm i exit-intent-quattro

    DownloadsWeekly Downloads

    167

    Version

    1.4.0

    License

    MIT

    Unpacked Size

    22.9 kB

    Total Files

    7

    Last publish

    Collaborators

    • johnnyoshika