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;
JS

version

Get the version of the extension.

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

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);
JS

isActivated

Get the status, if the extension is enabled.

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

activate

Activate the extension.

wtSmart.extension.scroll_depth.activate();
JS

deactivate

Deactivate the extension.

wtSmart.extension.scroll_depth.deactivate();
JS

simulate

Simulate an internal scroll or unload event.

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

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');
JS