0.2.0 • Published 7 years ago

analytics-scroll-depth v0.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Analytics Scroll Depth

npm package

Analytics Scroll Depth is a small, simple plugin that will pass your visitors scroll behavior to analytics.


Installation

npm install --save analytics-scroll-depth

Usage

import scrollDepth from 'analytics-scroll-depth'

scrollDepth()

Configuration

scrollDepth({
  throttle              : 250,
  minHeight             : 0,
  scrollElement         : document.documentElement,
  percentages           : [0.25, 0.5, 0.75, 0.9, 0.95, 0.99],
  pixelDepthInterval    : 500,
  elements              : [],
  dataLayer             : window.dataLayer,
  trackerName           : '',
  eventName             : 'CustomEvent',
  eventCategory         : 'Scroll Depth',
  percentageDepthAction : 'Percentage Depth',
  pixelDepthAction      : 'Pixel Depth',
  elementAction         : 'Element Depth',
  nonInteraction        : true,
})
SettingUnitDefault
throttlems250Throttle time
minHeightpx0The minimum height requirement for a page to collect scroll data
scrollElementnodedocument.documentElementThe element in which you wish to track scrolling.
percentagesarray0.25, 0.5, 0.75, 0.9, 0.95, 0.99An array of percentages that will be passed to analytics when a visitor reaches that point on the page
pixelDepthIntervalint500When a visitor passes this point * n, the value will be passed to analytics.
elementsarray[]An array of elements to track. The element will be passed to analytics when it is visible in the window
dataLayerarraywindow.dataLayerYour dataLayer element
trackerNamestring''If you use a tracker name, put it here
eventNamestring'CustomEvent'The event name used by your tag manger to capture the custom event
eventCategorystring'Scroll Depth'The event category that will be reported to analytics
percentageDepthActionstring'Percentage Depth'The event action that will be reported to analytics for percentage depth
pixelDepthActionstring'Pixel Depth'The event action that will be reported to analytics for pixel depth
elementActionstring'Element Depth'The event action that will be reported to analytics for element depth
nonInteractionbooltrueIf the event should be sent as a nonInteraction hit
0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago