0.0.6 • Published 4 years ago
@ktw-studio/analytics-scroll v0.0.6
Analitycs scroll
If you need to report scroll progress but don't like old jQuery copy-paste scripts this is package for you.
Usage:
- This package exposes default export of Reporter class which access configuration object
- Create instance of this class and provide required data:
- Start watching by running .hookUp() method. It attaches window.scroll listener.
- To finish watching events .hookDown() method needs to be called
- Callback parameter will receive value of how far user has scrolled. It will ignore every step already scrolled, only the biggest value of progress will be passed.
- You need to provide your own implementation of throttle function (for example from lodash)
- You need to specify throttle time.
{
step: number,
callback: callback,
throttleFunction: function,
throttleTime: number,
}