PluginProbe
Analytify – Google Analytics Dashboard For WordPress (GA4 analytics tracking) / trunk
Analytify – Google Analytics Dashboard For WordPress (GA4 analytics tracking) vtrunk
9.1.2 9.1.1 9.1.0 9.0.2 9.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 All 153 releases
wp-analytify / assets / js / scrolldepth.min.js

scrolldepth.min.js in Analytify – Google Analytics Dashboard For WordPress (GA4 analytics tracking) trunk, at assets/js/scrolldepth.min.js

1 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 !function(e){var n;function t(){if("undefined"!=typeof gtag||void 0!==window.dataLayer&&"function"==typeof window.dataLayer.push)e.scrollDepth();else{const n=50;let t=0;const o=setInterval(function(){t++,("undefined"!=typeof gtag||void 0!==window.dataLayer&&"function"==typeof window.dataLayer.push||t>=n)&&(clearInterval(o),e.scrollDepth())},100)}}n=function(e){"use strict";const n={percentage:!0},t=e(window);let o=[],i=!1,l=0;return e.scrollDepth=function(r){const a=+new Date;function c(e,n,t,o){if("undefined"!=typeof gtag){gtag("event","scroll_depth",{wpa_category:"Analytify Scroll Depth",wpa_percentage:n,non_interaction:!0});const t=o||+new Date-a;gtag("event","timing_complete",{event_category:"Analytify Scroll Depth",event_label:e+" - "+n+"%",value:t,non_interaction:!0})}}function f(){i=!0,t.on("scroll.scrollDepth",function(e,n){let t=null,o=0;return function(){const i=this,l=arguments,r=new Date;o||(o=r);const a=n-(r-o);a<=0?(clearTimeout(t),t=null,o=r,e.apply(i,l)):t||(t=setTimeout(function(){o=new Date,t=null,e.apply(i,l)},a))}}(function(){const n=e(document).height(),i=window.innerHeight?window.innerHeight:t.height(),l=t.scrollTop()+i,r=function(e){return{25:parseInt(.25*e,10),50:parseInt(.5*e,10),75:parseInt(.75*e,10),100:e-5}}(n);!function(n,t,i){e.each(n,function(n,l){-1===e.inArray(n,o)&&t>=l&&(c("undefined"!=typeof analytifyScroll&&analytifyScroll.permalink?analytifyScroll.permalink:window.location.href,n,0,i),o.push(n))})}(r,l,+new Date-a)},500))}r=e.extend({},n,r),e.scrollDepth.reset=function(){o=[],l=0,t.off("scroll.scrollDepth"),f()},e.scrollDepth.addElements=function(n){void 0!==n&&e.isArray(n)&&(e.merge(r.elements,n),i||f())},e.scrollDepth.removeElements=function(n){void 0!==n&&e.isArray(n)&&e.each(n,function(n,t){const i=e.inArray(t,r.elements),l=e.inArray(t,o);-1!=i&&r.elements.splice(i,1),-1!=l&&o.splice(l,1)})},function(){f();const n=e(document).height();if((window.innerHeight?window.innerHeight:t.height())>=n){const n=+new Date-a,t="undefined"!=typeof analytifyScroll&&analytifyScroll.permalink?analytifyScroll.permalink:window.location.href;-1===e.inArray("100",o)&&(c(t,"100",0,n),o.push("100"))}}()},e.scrollDepth},"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=n(require("jquery")):n(jQuery),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}(jQuery);