From b8ca6495f5bda6433b78022997aea8f9abffddf2 Mon Sep 17 00:00:00 2001 From: Rob Flaherty Date: Thu, 28 Apr 2016 15:25:43 -0400 Subject: [PATCH] version update --- bower.json | 4 ++-- jquery.scrolldepth.js | 4 ++-- jquery.scrolldepth.min.js | 6 +++--- package.json | 5 ++++- readme.md | 2 ++ 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/bower.json b/bower.json index 030eaf2..ba84141 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "scroll-depth", "main": "jquery.scrolldepth.js", - "version": "0.9.0", + "version": "0.9.1", "homepage": "http://scrolldepth.parsnip.io", "authors": [ "Rob Flaherty" @@ -17,7 +17,7 @@ ], "dependencies": { "jquery" : ">=1.8" - }, + }, "license": "MIT", "ignore": [ "test", diff --git a/jquery.scrolldepth.js b/jquery.scrolldepth.js index 625d4f3..bad5774 100644 --- a/jquery.scrolldepth.js +++ b/jquery.scrolldepth.js @@ -1,7 +1,7 @@ /*! * @preserve - * jquery.scrolldepth.js | v0.9 - * Copyright (c) 2015 Rob Flaherty (@robflaherty) + * jquery.scrolldepth.js | v0.9.1 + * Copyright (c) 2016 Rob Flaherty (@robflaherty) * Licensed under the MIT and GPL licenses. */ diff --git a/jquery.scrolldepth.min.js b/jquery.scrolldepth.min.js index e94c34c..2a2bc72 100644 --- a/jquery.scrolldepth.min.js +++ b/jquery.scrolldepth.min.js @@ -1,7 +1,7 @@ /*! * @preserve - * jquery.scrolldepth.js | v0.9 - * Copyright (c) 2015 Rob Flaherty (@robflaherty) + * jquery.scrolldepth.js | v0.9.1 + * Copyright (c) 2016 Rob Flaherty (@robflaherty) * Licensed under the MIT and GPL licenses. */ -!function(e,n,t){"use strict";var r,o,i,l,a={minHeight:0,elements:[],percentage:!0,userTiming:!0,pixelDepth:!0,nonInteraction:!0,gaGlobal:!1,gtmOverride:!1},c=e(n),u=[],p=!1,s=0;e.scrollDepth=function(h){function g(e,t,a,c){l?(l({event:"ScrollDistance",eventCategory:"Scroll Depth",eventAction:e,eventLabel:t,eventValue:1,eventNonInteraction:h.nonInteraction}),h.pixelDepth&&arguments.length>2&&a>s&&(s=a,l({event:"ScrollDistance",eventCategory:"Scroll Depth",eventAction:"Pixel Depth",eventLabel:D(a),eventValue:1,eventNonInteraction:h.nonInteraction})),h.userTiming&&arguments.length>3&&l({event:"ScrollTiming",eventCategory:"Scroll Depth",eventAction:e,eventLabel:t,eventTiming:c})):(r&&(n[i]("send","event","Scroll Depth",e,t,1,{nonInteraction:h.nonInteraction}),h.pixelDepth&&arguments.length>2&&a>s&&(s=a,n[i]("send","event","Scroll Depth","Pixel Depth",D(a),1,{nonInteraction:h.nonInteraction})),h.userTiming&&arguments.length>3&&n[i]("send","timing","Scroll Depth",e,c,t)),o&&(_gaq.push(["_trackEvent","Scroll Depth",e,t,1,h.nonInteraction]),h.pixelDepth&&arguments.length>2&&a>s&&(s=a,_gaq.push(["_trackEvent","Scroll Depth","Pixel Depth",D(a),1,h.nonInteraction])),h.userTiming&&arguments.length>3&&_gaq.push(["_trackTiming","Scroll Depth",e,c,t,100])))}function f(e){return{"25%":parseInt(.25*e,10),"50%":parseInt(.5*e,10),"75%":parseInt(.75*e,10),"100%":e-5}}function v(n,t,r){e.each(n,function(n,o){-1===e.inArray(n,u)&&t>=o&&(g("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&&(g("Elements",o,t,r),u.push(o))})}function D(e){return(250*Math.floor(e/250)).toString()}function d(){I()}function y(e,n){var t,r,o,i=null,l=0,a=function(){l=new Date,i=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(i),i=null,l=c,o=e.apply(t,r)):i||(i=setTimeout(a,u)),o}}function I(){p=!0,c.on("scroll.scrollDepth",y(function(){var r=e(t).height(),o=n.innerHeight?n.innerHeight:c.height(),i=c.scrollTop()+o,l=f(r),a=+new Date-S;return u.length>=h.elements.length+(h.percentage?4:0)?(c.off("scroll.scrollDepth"),void(p=!1)):(h.elements&&m(h.elements,i,a),void(h.percentage&&v(l,i,a)))},500))}var S=+new Date;h=e.extend({},a,h),e(t).height()2&&l>u&&(u=l,r({event:"ScrollDistance",eventCategory:"Scroll Depth",eventAction:"Pixel Depth",eventLabel:m(l),eventValue:1,eventNonInteraction:p.nonInteraction})),p.userTiming&&arguments.length>3&&r({event:"ScrollTiming",eventCategory:"Scroll Depth",eventAction:e,eventLabel:i,eventTiming:a})):(n&&(window[o]("send","event","Scroll Depth",e,i,1,{nonInteraction:p.nonInteraction}),p.pixelDepth&&arguments.length>2&&l>u&&(u=l,window[o]("send","event","Scroll Depth","Pixel Depth",m(l),1,{nonInteraction:p.nonInteraction})),p.userTiming&&arguments.length>3&&window[o]("send","timing","Scroll Depth",e,a,i)),t&&(_gaq.push(["_trackEvent","Scroll Depth",e,i,1,p.nonInteraction]),p.pixelDepth&&arguments.length>2&&l>u&&(u=l,_gaq.push(["_trackEvent","Scroll Depth","Pixel Depth",m(l),1,p.nonInteraction])),p.userTiming&&arguments.length>3&&_gaq.push(["_trackTiming","Scroll Depth",e,a,i,100])))}function h(e){return{"25%":parseInt(.25*e,10),"50%":parseInt(.5*e,10),"75%":parseInt(.75*e,10),"100%":e-5}}function g(n,t,o){e.each(n,function(n,r){-1===e.inArray(n,a)&&t>=r&&(s("Percentage",n,t,o),a.push(n))})}function f(n,t,o){e.each(n,function(n,r){-1===e.inArray(r,a)&&e(r).length&&t>=e(r).offset().top&&(s("Elements",r,t,o),a.push(r))})}function m(e){return(250*Math.floor(e/250)).toString()}function d(){D()}function v(e,n){var t,o,r,i=null,l=0,a=function(){l=new Date,i=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(i),i=null,l=c,r=e.apply(t,o)):i||(i=setTimeout(a,u)),r}}function D(){c=!0,l.on("scroll.scrollDepth",v(function(){var n=e(document).height(),t=window.innerHeight?window.innerHeight:l.height(),o=l.scrollTop()+t,r=h(n),i=+new Date-y;return a.length>=p.elements.length+(p.percentage?4:0)?(l.off("scroll.scrollDepth"),void(c=!1)):(p.elements&&f(p.elements,o,i),void(p.percentage&&g(r,o,i)))},500))}var y=+new Date;p=e.extend({},i,p),e(document).height()=1.8" + }, "homepage": "http://scrolldepth.parsnip.io/" } \ No newline at end of file diff --git a/readme.md b/readme.md index 25b9f05..91a790b 100644 --- a/readme.md +++ b/readme.md @@ -18,6 +18,8 @@ If you have any questions you can find me on Twitter at [@robflaherty](https://t ## Changelog +0.9.1 (4/28/18): Added support for Universal Module Definition (UMD). + 0.9 (11/19/15): Removed Baseline event. Added methods to add elements, remove elements, and reset the current scroll tracking state. 0.8 (7/18/15): Added option for custom GA global. Added '__gaTracker' as auto-detected global. Added option for overriding GTM.