Skip to content

Commit

Permalink
Stuff for v0.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
robflaherty committed Mar 1, 2014
1 parent ca17688 commit 863aef4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 43 deletions.
2 changes: 1 addition & 1 deletion jquery.scrolldepth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* @preserve
* jquery.scrolldepth.js | v0.4.1
* jquery.scrolldepth.js | v0.5
* Copyright (c) 2014 Rob Flaherty (@robflaherty)
* Licensed under the MIT and GPL licenses.
*/
Expand Down
4 changes: 2 additions & 2 deletions jquery.scrolldepth.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 9 additions & 40 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,21 @@
# Scroll Depth
Scroll Depth is a Google Analytics plugin that tracks how far users are scrolling. It monitors the 25%, 50%, 75%, and 100% scroll marks, sending a Google Analytics Event at each one.
Scroll Depth is a Google Analytics plugin that tracks how far users are scrolling. The plugin supports Universal Analytics, Classic Google Analytics, and Google Tag Manager.

In addition to the percentage scroll marks, you can record when specific elements on the page are scrolled into view. For example, on a blog, you could send a Scroll Depth event whenever the user reaches the end of a post.
**[All information is available on the Project Page](http://projects.parsnip.io/scroll-depth/)**

Timing data for each scroll event is reported to Google Analytics via the [User Timing API](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingTiming). You can find this data in Google Analytics at Content > Site Speed > User Timings. This will give you data about how many seconds it takes users to reach each scroll point. (Note: Averages can be misleading. Make sure to dig through the GA UI to dig up more meaningful data. You may also want to [increase the sample rate](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._setSiteSpeedSampleRate) from the default 5% to 100%.)
## Contributing
Bug reports and code contributions are welcome. Please see [contributing.md](https://github.com/robflaherty/jquery-scrolldepth/blob/master/contributing.md).

The plugin supports Universal Analytics, Classic Google Analytics, and Google Tag Manager.

[View the Project Page](http://parsnip.io/scroll-depth/)

[View the Blog Post](http://www.ravelrumba.com/blog/tracking-scroll-depth-jquery-google-analytics/)

## Usage
```javascript
// Basic
$.scrollDepth();

// With some options
$.scrollDepth({
minHeight: 2000, // Only track for documents taller than 2000px | Default: 0
elements: ['#comments', 'footer'] // Track DOM elements | Default: []
percentage: false, // Don't track depth percentage | Default: true
});
```

## Google Tag Manager
If you want to integrate with GTM, here are the dataLayer variable names:

* Scroll Distance Event Name = ScrollDistance
* Scroll Timing Event Name = ScrollTiming
* Event Category = {{eventCategory}}
* Event Action = {{eventAction}}
* Event Label = {{eventLabel}}
* Event Value = {{eventValue}}
* Event Non-Interaction = {{eventNonInteraction}}

## Requirements
* Google Analytics
* jQuery 1.7+

## Browser Support
Tested in Chrome (18), Firefox (8), Safari (5), Opera (10), IE (7-10). Also tested on iOS, Opera Mobile, and a few Android emulators.
## Testing
There's a test HTML file that mocks the Google Analytics functions and writes the GA Event data to the console.

## Contact
If you have any questions please leave a comment on the [associated blog post](http://www.ravelrumba.com/blog/tracking-scroll-depth-jquery-google-analytics/) or find me on Twitter at [@robflaherty](https://twitter.com/robflaherty).
If you have any questions you can find me on Twitter at [@robflaherty](https://twitter.com/robflaherty).

## Changelog

0.5 (2/13/14): Added Pixel Depth option. Added option to turn off UserTiming. Removed test mode option.

0.4.1 (2/13/14): Fixed GTM firing double events

0.4 (12/23/13): Added support for Google Tag Manager
Expand Down

0 comments on commit 863aef4

Please sign in to comment.