diff --git a/bower.json b/bower.json index 4f1c3aa..0e3b768 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "riveted", "main": "riveted.js", - "version": "0.6.0", + "version": "0.6.1", "homepage": "http://riveted.parsnip.io/", "authors": [ "Rob Flaherty" diff --git a/package.json b/package.json index e203ee3..d03f5a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "riveted", - "version": "0.6.0", + "version": "0.6.1", "description": "Riveted is a Google Analytics plugin that tracks how much time users spend actively engaged on a page.", "main": "riveted.js", "directories": { diff --git a/readme.md b/readme.md index 9e692d6..b1c7d9f 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,7 @@ Background and more details can be found in this [blog post](http://parsnip.io/b There's also a blog post with information on [how to use the Google Analytics data that Riveted provides](https://medium.com/google-analytics/84d9981920da). ## WordPress Plugin -Riveted is also available as a [WordPress plugin](http://wordpress.org/plugins/riveted/). Note that some of the more recent Riveted options are not available in the WP plugin. +Riveted is also available as a [WordPress plugin](http://wordpress.org/plugins/riveted/). Note that some of the more recent Riveted options are not available in the WP plugin. 1. Upload the `wp-plugin/riveted` directory into the `/wp-content/plugins/` directory on your server. 2. Activate the plugin through the 'Plugins' menu in WordPress. @@ -40,6 +40,8 @@ If you have any questions you can find me on Twitter at [@robflaherty](https://t ## Changelog +0.6.1 (4/28/16): Added Universal Module Definition (UMD) support. + 0.6.0 (6/12/15): Added reset method and option for custom GA tracker. 0.5.0 (4/14/15): Option for custom GA global name. Fixes problem with Yoast WP plugin. diff --git a/riveted.min.js b/riveted.min.js index 2c720d3..09c14bc 100644 --- a/riveted.min.js +++ b/riveted.min.js @@ -1,7 +1,7 @@ /*! * @preserve - * riveted.js | v0.6.0 - * Copyright (c) 2015 Rob Flaherty (@robflaherty) + * riveted.js | v0.6.1 + * Copyright (c) 2016 Rob Flaherty (@robflaherty) * Licensed under the MIT license */ -var riveted=function(){function e(e){e=e||{},g=parseInt(e.reportInterval,10)||5,p=parseInt(e.idleTimeout,10)||30,k=e.gaGlobal||"ga","function"==typeof window[k]&&(y=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(w=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(h=!0),I="gaTracker"in e&&"string"==typeof e.gaTracker?e.gaTracker+".send":"send","function"==typeof e.eventHandler&&(s=e.eventHandler),"function"==typeof e.userTimingHandler&&(m=e.userTimingHandler),T="nonInteraction"in e&&(e.nonInteraction===!1||"false"===e.nonInteraction)?!1:!0,t(document,"keydown",f),t(document,"click",f),t(window,"mousemove",n(f,500)),t(window,"scroll",n(f,500)),t(document,"visibilitychange",a),t(document,"webkitvisibilitychange",a)}function n(e,n){var t,i,a,o=null,r=0,u=function(){r=new Date,o=null,a=e.apply(t,i)};return function(){var c=new Date;r||(r=c);var d=n-(c-r);return t=this,i=arguments,0>=d?(clearTimeout(o),o=null,r=c,a=e.apply(t,i)):o||(o=setTimeout(u,d)),a}}function t(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent?e.attachEvent("on"+n,t):e["on"+n]=t}function i(){clearTimeout(H),r()}function a(){(document.hidden||document.webkitHidden)&&i()}function o(){_+=1,_>0&&_%g===0&&s(_)}function r(){L=!0,clearTimeout(E)}function u(){i(),b=!0}function c(){b=!1}function d(){L=!1,clearTimeout(E),E=setInterval(o,1e3)}function l(){var e=new Date,n=e-D;R=!0,m(n),E=setInterval(o,1e3)}function v(){D=new Date,_=0,R=!1,L=!1,clearTimeout(E),clearTimeout(H)}function f(){b||(R||l(),L&&d(),clearTimeout(H),H=setTimeout(i,1e3*p+100))}var s,m,g,p,T,y,w,I,h,k,R=!1,L=!1,b=!1,_=0,D=new Date,E=null,H=null;return m=function(e){h?dataLayer.push({event:"RivetedTiming",eventCategory:"Riveted",timingVar:"First Interaction",timingValue:e}):(y&&window[k](I,"timing","Riveted","First Interaction",e),w&&_gaq.push(["_trackTiming","Riveted","First Interaction",e,null,100]))},s=function(e){h?dataLayer.push({event:"Riveted",eventCategory:"Riveted",eventAction:"Time Spent",eventLabel:e,eventValue:g,eventNonInteraction:T}):(y&&window[k](I,"event","Riveted","Time Spent",e.toString(),g,{nonInteraction:T}),w&&_gaq.push(["_trackEvent","Riveted","Time Spent",e.toString(),g,T]))},{init:e,trigger:f,setIdle:i,on:c,off:u,reset:v}}(); \ No newline at end of file +!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof module&&module.exports?module.exports=n():e.riveted=n()}(this,function(){var e=function(){function e(e){e=e||{},p=parseInt(e.reportInterval,10)||5,g=parseInt(e.idleTimeout,10)||30,k=e.gaGlobal||"ga","function"==typeof window[k]&&(w=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(I=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(h=!0),T="gaTracker"in e&&"string"==typeof e.gaTracker?e.gaTracker+".send":"send","function"==typeof e.eventHandler&&(s=e.eventHandler),"function"==typeof e.userTimingHandler&&(m=e.userTimingHandler),y="nonInteraction"in e&&(e.nonInteraction===!1||"false"===e.nonInteraction)?!1:!0,t(document,"keydown",v),t(document,"click",v),t(window,"mousemove",n(v,500)),t(window,"scroll",n(v,500)),t(document,"visibilitychange",o),t(document,"webkitvisibilitychange",o)}function n(e,n){var t,i,o,a=null,r=0,u=function(){r=new Date,a=null,o=e.apply(t,i)};return function(){var c=new Date;r||(r=c);var d=n-(c-r);return t=this,i=arguments,0>=d?(clearTimeout(a),a=null,r=c,o=e.apply(t,i)):a||(a=setTimeout(u,d)),o}}function t(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent?e.attachEvent("on"+n,t):e["on"+n]=t}function i(){clearTimeout(H),r()}function o(){(document.hidden||document.webkitHidden)&&i()}function a(){_+=1,_>0&&_%p===0&&s(_)}function r(){b=!0,clearInterval(E)}function u(){i(),L=!0}function c(){L=!1}function d(){b=!1,clearInterval(E),E=setInterval(a,1e3)}function l(){var e=new Date,n=e-D;R=!0,m(n),E=setInterval(a,1e3)}function f(){D=new Date,_=0,R=!1,b=!1,clearInterval(E),clearTimeout(H)}function v(){L||(R||l(),b&&d(),clearTimeout(H),H=setTimeout(i,1e3*g+100))}var s,m,p,g,y,w,I,T,h,k,R=!1,b=!1,L=!1,_=0,D=new Date,E=null,H=null;return m=function(e){h?dataLayer.push({event:"RivetedTiming",eventCategory:"Riveted",timingVar:"First Interaction",timingValue:e}):(w&&window[k](T,"timing","Riveted","First Interaction",e),I&&_gaq.push(["_trackTiming","Riveted","First Interaction",e,null,100]))},s=function(e){h?dataLayer.push({event:"Riveted",eventCategory:"Riveted",eventAction:"Time Spent",eventLabel:e,eventValue:p,eventNonInteraction:y}):(w&&window[k](T,"event","Riveted","Time Spent",e.toString(),p,{nonInteraction:y}),I&&_gaq.push(["_trackEvent","Riveted","Time Spent",e.toString(),p,y]))},{init:e,trigger:v,setIdle:i,on:c,off:u,reset:f}}();return e}); \ No newline at end of file diff --git a/wp-plugin/riveted/js/riveted-wp.js b/wp-plugin/riveted/js/riveted-wp.js index 2a1c22a..3024e8f 100644 --- a/wp-plugin/riveted/js/riveted-wp.js +++ b/wp-plugin/riveted/js/riveted-wp.js @@ -1,7 +1,7 @@ /*! * @preserve - * riveted.js | v0.4.0 - * Copyright (c) 2014 Rob Flaherty (@robflaherty) + * riveted.js | v0.6.1 + * Copyright (c) 2016 Rob Flaherty (@robflaherty) * Licensed under the MIT license */ -var riveted=function(){function e(e){"function"==typeof ga&&(y=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(T=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(I=!0),e=e||{},m=parseInt(e.reportInterval,10)||5,g=parseInt(e.idleTimeout,10)||30,"function"==typeof e.eventHandler&&(f=e.eventHandler),"function"==typeof e.userTimingHandler&&(s=e.userTimingHandler),p="nonInteraction"in e&&(e.nonInteraction===!1||"false"===e.nonInteraction)?!1:!0,t(document,"keydown",v),t(document,"click",v),t(window,"mousemove",n(v,500)),t(window,"scroll",n(v,500)),t(document,"visibilitychange",o),t(document,"webkitvisibilitychange",o)}function n(e,n){var t,i,o,a=null,r=0,u=function(){r=new Date,a=null,o=e.apply(t,i)};return function(){var c=new Date;r||(r=c);var d=n-(c-r);return t=this,i=arguments,0>=d?(clearTimeout(a),a=null,r=c,o=e.apply(t,i)):a||(a=setTimeout(u,d)),o}}function t(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent?e.attachEvent("on"+n,t):e["on"+n]=t}function i(){clearTimeout(b),r()}function o(){(document.hidden||document.webkitHidden)&&i()}function a(){L+=1,L>0&&L%m===0&&f(L)}function r(){w=!0,clearTimeout(_)}function u(){i(),R=!0}function c(){R=!1}function d(){w=!1,clearTimeout(_),_=setInterval(a,1e3)}function l(){var e=new Date,n=e-k;h=!0,s(n),_=setInterval(a,1e3)}function v(){R||(h||l(),w&&d(),clearTimeout(b),b=setTimeout(i,1e3*g+100))}var f,s,m,g,p,y,T,I,h=!1,w=!1,R=!1,L=0,k=new Date,_=null,b=null;return s=function(e){I?dataLayer.push({event:"RivetedTiming",eventCategory:"Riveted",timingVar:"First Interaction",timingValue:e}):(y&&ga("send","timing","Riveted","First Interaction",e),T&&_gaq.push(["_trackTiming","Riveted","First Interaction",e,null,100]))},f=function(e){I?dataLayer.push({event:"Riveted",eventCategory:"Riveted",eventAction:"Time Spent",eventLabel:e,eventValue:m,eventNonInteraction:p}):(y&&ga("send","event","Riveted","Time Spent",e.toString(),m,{nonInteraction:p}),T&&_gaq.push(["_trackEvent","Riveted","Time Spent",e.toString(),m,p]))},{init:e,trigger:v,setIdle:i,on:c,off:u}}();riveted.init(riveted_options); \ No newline at end of file +!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof module&&module.exports?module.exports=n():e.riveted=n()}(this,function(){var e=function(){function e(e){e=e||{},p=parseInt(e.reportInterval,10)||5,g=parseInt(e.idleTimeout,10)||30,k=e.gaGlobal||"ga","function"==typeof window[k]&&(w=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(I=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(h=!0),T="gaTracker"in e&&"string"==typeof e.gaTracker?e.gaTracker+".send":"send","function"==typeof e.eventHandler&&(s=e.eventHandler),"function"==typeof e.userTimingHandler&&(m=e.userTimingHandler),y="nonInteraction"in e&&(e.nonInteraction===!1||"false"===e.nonInteraction)?!1:!0,t(document,"keydown",v),t(document,"click",v),t(window,"mousemove",n(v,500)),t(window,"scroll",n(v,500)),t(document,"visibilitychange",o),t(document,"webkitvisibilitychange",o)}function n(e,n){var t,i,o,a=null,r=0,u=function(){r=new Date,a=null,o=e.apply(t,i)};return function(){var c=new Date;r||(r=c);var d=n-(c-r);return t=this,i=arguments,0>=d?(clearTimeout(a),a=null,r=c,o=e.apply(t,i)):a||(a=setTimeout(u,d)),o}}function t(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent?e.attachEvent("on"+n,t):e["on"+n]=t}function i(){clearTimeout(H),r()}function o(){(document.hidden||document.webkitHidden)&&i()}function a(){_+=1,_>0&&_%p===0&&s(_)}function r(){b=!0,clearInterval(E)}function u(){i(),L=!0}function c(){L=!1}function d(){b=!1,clearInterval(E),E=setInterval(a,1e3)}function l(){var e=new Date,n=e-D;R=!0,m(n),E=setInterval(a,1e3)}function f(){D=new Date,_=0,R=!1,b=!1,clearInterval(E),clearTimeout(H)}function v(){L||(R||l(),b&&d(),clearTimeout(H),H=setTimeout(i,1e3*g+100))}var s,m,p,g,y,w,I,T,h,k,R=!1,b=!1,L=!1,_=0,D=new Date,E=null,H=null;return m=function(e){h?dataLayer.push({event:"RivetedTiming",eventCategory:"Riveted",timingVar:"First Interaction",timingValue:e}):(w&&window[k](T,"timing","Riveted","First Interaction",e),I&&_gaq.push(["_trackTiming","Riveted","First Interaction",e,null,100]))},s=function(e){h?dataLayer.push({event:"Riveted",eventCategory:"Riveted",eventAction:"Time Spent",eventLabel:e,eventValue:p,eventNonInteraction:y}):(w&&window[k](T,"event","Riveted","Time Spent",e.toString(),p,{nonInteraction:y}),I&&_gaq.push(["_trackEvent","Riveted","Time Spent",e.toString(),p,y]))},{init:e,trigger:v,setIdle:i,on:c,off:u,reset:f}}();return e});riveted.init(riveted_options); \ No newline at end of file