From f846eb7343c4e2f1cd13908820722ff435a73013 Mon Sep 17 00:00:00 2001 From: Rob Flaherty Date: Sat, 18 Jul 2015 12:49:04 -0400 Subject: [PATCH] version updates for 0.8 release --- bower.json | 2 +- jquery.scrolldepth.js | 2 +- jquery.scrolldepth.min.js | 4 ++-- readme.md | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 1c8779a..a262b16 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "scroll-depth", "main": "jquery.scrolldepth.js", - "version": "0.7.2", + "version": "0.8.0", "homepage": "http://scrolldepth.parsnip.io", "authors": [ "Rob Flaherty" diff --git a/jquery.scrolldepth.js b/jquery.scrolldepth.js index 0c2a739..89f08e2 100644 --- a/jquery.scrolldepth.js +++ b/jquery.scrolldepth.js @@ -1,6 +1,6 @@ /*! * @preserve - * jquery.scrolldepth.js | v0.7.2 + * jquery.scrolldepth.js | v0.8 * Copyright (c) 2015 Rob Flaherty (@robflaherty) * Licensed under the MIT and GPL licenses. */ diff --git a/jquery.scrolldepth.min.js b/jquery.scrolldepth.min.js index 25d8b7f..cfaa83f 100644 --- a/jquery.scrolldepth.min.js +++ b/jquery.scrolldepth.min.js @@ -1,7 +1,7 @@ /*! * @preserve - * jquery.scrolldepth.js | v0.7.2 + * jquery.scrolldepth.js | v0.8 * Copyright (c) 2015 Rob Flaherty (@robflaherty) * Licensed under the MIT and GPL licenses. */ -!function(e,n,t){"use strict";var o,r,a,l={minHeight:0,elements:[],percentage:!0,userTiming:!0,pixelDepth:!0,nonInteraction:!0},i=e(n),c=[],u=0;e.scrollDepth=function(h){function p(e){a?a({event:"ScrollDistance",eventCategory:"Scroll Depth",eventAction:e,eventLabel:"Baseline",eventValue:1,eventNonInteraction:!0}):(o&&ga("send","event","Scroll Depth",e,"Baseline",1,{nonInteraction:!0}),r&&_gaq.push(["_trackEvent","Scroll Depth",e,"Baseline",1,!0]))}function g(e,n,t,l){a?(a({event:"ScrollDistance",eventCategory:"Scroll Depth",eventAction:e,eventLabel:n,eventValue:1,eventNonInteraction:h.nonInteraction}),h.pixelDepth&&arguments.length>2&&t>u&&(u=t,a({event:"ScrollDistance",eventCategory:"Scroll Depth",eventAction:"Pixel Depth",eventLabel:D(t),eventValue:1,eventNonInteraction:h.nonInteraction})),h.userTiming&&arguments.length>3&&a({event:"ScrollTiming",eventCategory:"Scroll Depth",eventAction:e,eventLabel:n,eventTiming:l})):(o&&(ga("send","event","Scroll Depth",e,n,1,{nonInteraction:h.nonInteraction}),h.pixelDepth&&arguments.length>2&&t>u&&(u=t,ga("send","event","Scroll Depth","Pixel Depth",D(t),1,{nonInteraction:h.nonInteraction})),h.userTiming&&arguments.length>3&&ga("send","timing","Scroll Depth",e,l,n)),r&&(_gaq.push(["_trackEvent","Scroll Depth",e,n,1,h.nonInteraction]),h.pixelDepth&&arguments.length>2&&t>u&&(u=t,_gaq.push(["_trackEvent","Scroll Depth","Pixel Depth",D(t),1,h.nonInteraction])),h.userTiming&&arguments.length>3&&_gaq.push(["_trackTiming","Scroll Depth",e,l,n,100])))}function s(e){return{"25%":parseInt(.25*e,10),"50%":parseInt(.5*e,10),"75%":parseInt(.75*e,10),"100%":e-5}}function v(n,t,o){e.each(n,function(n,r){-1===e.inArray(n,c)&&t>=r&&(g("Percentage",n,t,o),c.push(n))})}function f(n,t,o){e.each(n,function(n,r){-1===e.inArray(r,c)&&e(r).length&&t>=e(r).offset().top&&(g("Elements",r,t,o),c.push(r))})}function D(e){return(250*Math.floor(e/250)).toString()}function m(e,n){var t,o,r,a=null,l=0,i=function(){l=new Date,a=null,r=e.apply(t,o)};return function(){var c=new Date;l||(l=c);var u=n-(c-l);return t=this,o=arguments,0>=u?(clearTimeout(a),a=null,l=c,r=e.apply(t,o)):a||(a=setTimeout(i,u)),r}}var d=+new Date;h=e.extend({},l,h),e(t).height()=4+h.elements.length?void i.off("scroll.scrollDepth"):(h.elements&&f(h.elements,a,u),void(h.percentage&&v(l,a,u)))},500)))}}(jQuery,window,document); \ No newline at end of file +!function(e,n,t){"use strict";var r,o,a,l,i={minHeight:0,elements:[],percentage:!0,userTiming:!0,pixelDepth:!0,nonInteraction:!0,gaGlobal:!1,gtmOverride:!1},c=e(n),u=[],g=0;e.scrollDepth=function(h){function p(e){l?l({event:"ScrollDistance",eventCategory:"Scroll Depth",eventAction:e,eventLabel:"Baseline",eventValue:1,eventNonInteraction:!0}):(r&&n[a]("send","event","Scroll Depth",e,"Baseline",1,{nonInteraction:!0}),o&&_gaq.push(["_trackEvent","Scroll Depth",e,"Baseline",1,!0]))}function s(e,t,i,c){l?(l({event:"ScrollDistance",eventCategory:"Scroll Depth",eventAction:e,eventLabel:t,eventValue:1,eventNonInteraction:h.nonInteraction}),h.pixelDepth&&arguments.length>2&&i>g&&(g=i,l({event:"ScrollDistance",eventCategory:"Scroll Depth",eventAction:"Pixel Depth",eventLabel:D(i),eventValue:1,eventNonInteraction:h.nonInteraction})),h.userTiming&&arguments.length>3&&l({event:"ScrollTiming",eventCategory:"Scroll Depth",eventAction:e,eventLabel:t,eventTiming:c})):(r&&(n[a]("send","event","Scroll Depth",e,t,1,{nonInteraction:h.nonInteraction}),h.pixelDepth&&arguments.length>2&&i>g&&(g=i,n[a]("send","event","Scroll Depth","Pixel Depth",D(i),1,{nonInteraction:h.nonInteraction})),h.userTiming&&arguments.length>3&&n[a]("send","timing","Scroll Depth",e,c,t)),o&&(_gaq.push(["_trackEvent","Scroll Depth",e,t,1,h.nonInteraction]),h.pixelDepth&&arguments.length>2&&i>g&&(g=i,_gaq.push(["_trackEvent","Scroll Depth","Pixel Depth",D(i),1,h.nonInteraction])),h.userTiming&&arguments.length>3&&_gaq.push(["_trackTiming","Scroll Depth",e,c,t,100])))}function v(e){return{"25%":parseInt(.25*e,10),"50%":parseInt(.5*e,10),"75%":parseInt(.75*e,10),"100%":e-5}}function f(n,t,r){e.each(n,function(n,o){-1===e.inArray(n,u)&&t>=o&&(s("Percentage",n,t,r),u.push(n))})}function m(n,t,r){e.each(n,function(n,o){-1===e.inArray(o,u)&&e(o).length&&t>=e(o).offset().top&&(s("Elements",o,t,r),u.push(o))})}function D(e){return(250*Math.floor(e/250)).toString()}function d(e,n){var t,r,o,a=null,l=0,i=function(){l=new Date,a=null,o=e.apply(t,r)};return function(){var c=new Date;l||(l=c);var u=n-(c-l);return t=this,r=arguments,0>=u?(clearTimeout(a),a=null,l=c,o=e.apply(t,r)):a||(a=setTimeout(i,u)),o}}var y=+new Date;h=e.extend({},i,h),e(t).height()=4+h.elements.length?void c.off("scroll.scrollDepth"):(h.elements&&m(h.elements,a,i),void(h.percentage&&f(l,a,i)))},500)))}}(jQuery,window,document); \ No newline at end of file diff --git a/readme.md b/readme.md index 42055e1..90c294a 100644 --- a/readme.md +++ b/readme.md @@ -14,6 +14,8 @@ If you have any questions you can find me on Twitter at [@robflaherty](https://t ## Changelog +0.8 (7/18/15): Added option for custom GA global. Added '__gaTracker' as auto-detected global. Added option for overriding GTM. + 0.7.2 (6/8/15): Fixed bug: https://github.com/robflaherty/jquery-scrolldepth/issues/62 0.7 (11/26/14): Added custom callback for sending scroll events to non-GA services