-
Notifications
You must be signed in to change notification settings - Fork 1
/
jquery.gaplaylength.min.js
17 lines (17 loc) · 3.81 KB
/
jquery.gaplaylength.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports["jquery.gaplaylength"]=t():e["jquery.gaplaylength"]=t()}(this,function(){return function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={exports:{},id:a,loaded:!1};return e[a].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}var r=n(1),u=a(r);jQuery.fn.gaPlayLength=function(e){return this.each(function(){u.init(this,e)})}},function(e,t,n){/*!
* gaplaylength.js | v0.3
* Copyright (c) 2015 Leigh McCulloch
* Licensed under the ICS license.
*
* Inspired by and derived from jquery.scrolldepth.js
* which may be freely distributed under the MIT and GPL licenses.
* Copyright (c) 2014 Rob Flaherty (@robflaherty).
*/
"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function r(e){function t(e,t,n,r){s?(dataLayer.push({event:"PlayLength",eventCategory:"Play Length",eventAction:e,eventLabel:t,eventValue:1,eventNonInteraction:!0}),v&&arguments.length>2&&n>c&&(c=n,dataLayer.push({event:"PlayLength",eventCategory:"Play Length",eventAction:"Audio Time",eventLabel:a(n),eventValue:1,eventNonInteraction:!0})),h&&arguments.length>3&&dataLayer.push({event:"PlayTiming",eventCategory:"Play Length",eventAction:e,eventLabel:t,eventTiming:r})):(f&&(ga("send","event","Play Length",e,t,1,{nonInteraction:1}),v&&arguments.length>2&&n>c&&(c=n,ga("send","event","Play Length","Audio Time",a(n),1,{nonInteraction:1})),h&&arguments.length>3&&ga("send","timing","Play Length",e,r,t)),d&&(_gaq.push(["_trackEvent","Play Length",e,t,1,!0]),v&&arguments.length>2&&n>c&&(c=n,_gaq.push(["_trackEvent","Play Length","Audio Time",a(n),1,!0])),h&&arguments.length>3&&_gaq.push(["_trackTiming","Play Length",e,r,t,100])))}function n(e){return{"10%":parseInt(.1*e,10),"25%":parseInt(.25*e,10),"50%":parseInt(.5*e,10),"75%":parseInt(.75*e,10)}}function a(e){return(10*Math.floor(e/10)).toString()}function r(){var e="Baseline";-1===m.indexOf(e)&&(t("Percentage",e),m.push(e))}function u(){var a=e.duration,r=e.currentTime;if(!isNaN(e.duration)){var u=n(a),o=+new Date-L;for(var i in u){var l=u[i];-1===m.indexOf(i)&&r>=l&&(t("Percentage",i,r,o),m.push(i))}}}function i(){var n="100%";if(-1===m.indexOf(n)){var a=+new Date-L;t("Percentage",n,e.duration,a),m.push(n)}}var f,d,s,c,g=void 0===arguments[1]?{}:arguments[1],p=g.audioTime,v=void 0===p?!0:p,y=g.userTiming,h=void 0===y?!0:y,m=[],L=+new Date;"function"==typeof ga&&(f=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(d=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(s=!0),o["default"](e,"play",r,!1),o["default"](e,"timeupdate",l["default"](u,500),!1),o["default"](e,"ended",i,!1)}Object.defineProperty(t,"__esModule",{value:!0}),t.init=r;var u=n(2),o=a(u),i=n(3),l=a(i)},function(e,t){"use strict";function n(e,t,n,a){e.addEventListener?e.addEventListener(t,n,a):e.attachEvent&&e.attachEvent(t,n)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t){/*!
* Throttle function borrowed from:
* Underscore.js 1.5.2
* http://underscorejs.org
* (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Underscore may be freely distributed under the MIT license.
*/
"use strict";function n(e,t){var n,a,r,u=null,o=0,i=function(){o=new Date,u=null,r=e.apply(n,a)};return function(){var l=new Date;o||(o=l);var f=t-(l-o);return n=this,a=arguments,0>=f?(clearTimeout(u),u=null,o=l,r=e.apply(n,a)):u||(u=setTimeout(i,f)),r}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]}])});