jQuery Plugin To Tract Track Scroll Depth For Google Analytics - scrollDepth

jQuery Plugin To Tract Track Scroll Depth For Google Analytics - scrollDepth

scrollDepth is a lightweight yet very useful jQuery plugin for webpage UX / SEO that detect the distance (25%, 50%, 75%, and 100% scroll points) the user has scrolled and then send the data to Google Analytics via events ( or any analytics service that supports events).

Basic usage:

1. Load the minified version of jQuery scrollDepth plugin after JQuery library as this:

<script src="/path/to/jquery.min.js"></script>
<script src="/path/to/jquery.scrolldepth.min.js"></script>

2. Initialize the plugin and we're ready to go.

jQuery.scrollDepth();

3. Default plugin options.

jQuery.scrollDepth({
  // disable scroll tracking when documents is smaller than:
  minHeight: 0,
  // an array of elements to record scroll events
  elements: [],
  // enable scroll percentage tracking
  percentage: true,
  // enable User Timing events
  userTiming: true,
  // enabled Pixel Depth events
  pixelDepth: true,
  // true: scroll events will not impact your bounce rate
  nonInteraction: true,
  // If you're using Universal Analytics and have changed the global object name from the default "ga". 
  gaGlobal: false,
  // By default, if Scroll Depth detects Google Tag Manager it assumes that you're using it for your GA implementation.
  // If you're using GTM but not using it for GA then you can set this option to true and Scroll Depth will ignore GTM
  gtmOverride: false,
  // custom tracker name.
  trackerName: false,
  // custom data layer name
  dataLayer: 'dataLayer'
  
});

4. API methods.

// reset
jQuery.scrollDepth.reset();
// add more elements
jQuery.scrollDepth.addElements(['aside', 'footer']);
// remode elements
jQuery.scrollDepth.removeElements(['#el']);

Changelog:

2018-06-06

  • Added support forĀ gtag.js

This awesome jQuery plugin is developed by robflaherty. For more Advanced Usages, please check the demo page or visit the official website.

  • Publication date: 06.06.2018
  • Source

Whoops, looks like something went wrong.

(1/1) ErrorException

file_put_contents(): Only 0 of 267 bytes written, possibly out of free disk space

in Filesystem.php (line 122)
at HandleExceptions->handleError(2, 'file_put_contents(): Only 0 of 267 bytes written, possibly out of free disk space', '/home/p336588/web/ivanovdmitry.com/public_html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', 122, array('path' => '/home/p336588/web/ivanovdmitry.com/public_html/storage/framework/sessions/qZXPvXJhirxlDwYHyO6Vab0DqBIqKFj1YWt7XMTf', 'contents' => 'a:3:{s:6:"_token";s:40:"01tnHIxJWXtWZVM8IxKHCcqLYNMYA389WDChqxHy";s:9:"_previous";a:1:{s:3:"url";s:108:"http://ivanovdmitry.com/blog/post/jquery-plugin-to-tract-track-scroll-depth-for-google-analytics-scrolldepth";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', 'lock' => true))
at file_put_contents('/home/p336588/web/ivanovdmitry.com/public_html/storage/framework/sessions/qZXPvXJhirxlDwYHyO6Vab0DqBIqKFj1YWt7XMTf', 'a:3:{s:6:"_token";s:40:"01tnHIxJWXtWZVM8IxKHCcqLYNMYA389WDChqxHy";s:9:"_previous";a:1:{s:3:"url";s:108:"http://ivanovdmitry.com/blog/post/jquery-plugin-to-tract-track-scroll-depth-for-google-analytics-scrolldepth";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', 2)in Filesystem.php (line 122)
at Filesystem->put('/home/p336588/web/ivanovdmitry.com/public_html/storage/framework/sessions/qZXPvXJhirxlDwYHyO6Vab0DqBIqKFj1YWt7XMTf', 'a:3:{s:6:"_token";s:40:"01tnHIxJWXtWZVM8IxKHCcqLYNMYA389WDChqxHy";s:9:"_previous";a:1:{s:3:"url";s:108:"http://ivanovdmitry.com/blog/post/jquery-plugin-to-tract-track-scroll-depth-for-google-analytics-scrolldepth";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', true)in FileSessionHandler.php (line 83)
at FileSessionHandler->write('qZXPvXJhirxlDwYHyO6Vab0DqBIqKFj1YWt7XMTf', 'a:3:{s:6:"_token";s:40:"01tnHIxJWXtWZVM8IxKHCcqLYNMYA389WDChqxHy";s:9:"_previous";a:1:{s:3:"url";s:108:"http://ivanovdmitry.com/blog/post/jquery-plugin-to-tract-track-scroll-depth-for-google-analytics-scrolldepth";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}')in Store.php (line 128)
at Store->save()in StartSession.php (line 88)
at StartSession->terminate(object(Request), object(Response))in Kernel.php (line 218)
at Kernel->terminateMiddleware(object(Request), object(Response))in Kernel.php (line 189)
at Kernel->terminate(object(Request), object(Response))in index.php (line 58)