Scroll Depth
    • 1 Minute to read
    • Dark
      Light

    Scroll Depth

    • Dark
      Light

    Article summary

    The scroll depth extension is used to record how far users scroll down on a web page. This is a reference value that is of interest when you wish to find out more about user behavior. Learn more here.

    The predefined IDs are assigned to each parameters:

    • Event parameter 501: Scroll Depth (Figure) 

    • Event parameter 502: Page Length

    • Event parameter 540: Scroll Depth

    Methods and properties

    name

    Get the name of the extension.

    /**
     * @type {string}
     */
    wtSmart.extension.scroll_depth.name;

    version

    Get the version of the extension.

    /**
     * @type {string}
     */
    wtSmart.extension.scroll_depth.version;

    config

    Set and get the current configuration of the extension.

    • roundResult: By default the scroll depth in percent gets rounded up to full fives. Deactivate this option, to receive more detailed results.

    /**
     * @param {{
     *      [roundResult=true]: boolean
     * }} [config]
     *
     * @returns {object}
     */
    wtSmart.extension.scroll_depth.config(config);

    isActivated

    Get the status, if the extension is enabled.

    /**
     * @returns {boolean}
     */
    wtSmart.extension.scroll_depth.isActivated();

    activate

    Activate the extension.

    wtSmart.extension.scroll_depth.activate();

    deactivate

    Deactivate the extension.

    wtSmart.extension.scroll_depth.deactivate();

    simulate

    Simulate an internal scroll or unload event.

    /**
     * @param {string} eventName (scroll | unload)
     */
    wtSmart.extension.scroll_depth.simulate(eventName);

    Example

    // is scroll depth activated
    var isActivated = wtSmart.extension.scroll_depth.isActivated();
    
    // set scroll depth config
    wtSmart.extension.scroll_depth.config({
        roundResult: false
    });
    
    // get scroll depth config
    var scrollDepthConfig = wtSmart.extension.scroll_depth.config();
    
    // activate scroll depth
    wtSmart.extension.scroll_depth.activate();
    
    // deactivate scroll depth
    wtSmart.extension.scroll_depth.deactivate();
    
    // simulate an internal unload event
    wtSmart.extension.scroll_depth.simulate('unload');

    Code Generator

    Use the code generator to create individual code that you can then integrate directly into the website.


    Was this article helpful?