ga-track-scroll

2.3.0 • Public • Published

Google Analytics Scroll

NPM

Auto-track scroll depth for Google Analytics.

Installation

npm install ga-track-scroll

or

yarn add ga-track-scroll

Usage

import 'ga-track-scroll'

Once the user starts scrolling it will send events to Google Analytics:

  • category: scroll
  • action: document.location.toString()
  • label: "Scrolled X%" (25/50/75/100) (There's also a simple Scrolled event 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
});

Package Sidebar

Install

npm i ga-track-scroll

Weekly Downloads

16

Version

2.3.0

License

MIT

Unpacked Size

67.2 kB

Total Files

10

Last publish

Collaborators

  • jga
  • dawnerd
  • alaguna
  • ecwillis
  • orthagonal1
  • aleperez92