2.3.0 • Published 5 years ago
ga-track-scroll v2.3.0
Auto-track scroll depth for Google Analytics.
Installation
npm install ga-track-scrollor
yarn add ga-track-scrollUsage
import 'ga-track-scroll'Once the user starts scrolling it will send events to Google Analytics:
category: scrollaction:document.location.toString()label: "Scrolled X%" (25/50/75/100) (There's also a simpleScrolledevent the first time the user scrolls)value: X (25/50/75/100)
It does also fire a custom event on the DOM:
document.addEventListener('user:scroll', event => {
const { amount } = event.detail; // Can be 25/50/75/100
});