-
Notifications
You must be signed in to change notification settings - Fork 2
/
rakam.nocompat.min.js
1 lines (1 loc) · 20.1 KB
/
rakam.nocompat.min.js
1
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).rakam=e()}(this,function(){"use strict";function l(){for(var t="",e=0;e<22;++e)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(Math.floor(64*Math.random()));return t}function t(t){try{for(var e=document.cookie.split(";"),n=null,o=0;o<e.length;o++){for(var i=e[o];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t)){n=i.substring(t.length,i.length);break}}return n}catch(t){return null}}function e(t,e,n){var o,i=null!==e?n.expirationDays:-1;i&&((o=new Date).setTime(o.getTime()+24*i*60*60*1e3),i=o);var s=t+"="+e;i&&(s+="; expires="+i.toUTCString()),s+="; path=/",n.domain&&(s+="; domain="+n.domain),n.secure&&(s+="; Secure"),n.sameSite&&(s+="; SameSite="+n.sameSite),document.cookie=s}function i(t){for(var e,n,o=(e=t,(n=document.createElement("a")).href=e,n.hostname||location.hostname).split("."),i=[],s="_tldtest_"+l(),r=o.length-2;0<=r;--r)i.push(o.slice(r).join("."));for(var a=0;a<i.length;++a){var u=i[a],p={domain:"."+u};if(d(s,1,p),m(s))return d(s,null,p),u}return""}function r(t){var e="";return s.domain&&(e="."===s.domain.charAt(0)?s.domain.substring(1):s.domain),t+e}var n,h=function(t){for(var e="",n=0;n<t.length;n++){var o=t.charCodeAt(n);o<128?e+=String.fromCharCode(o):(127<o&&o<2048?e+=String.fromCharCode(o>>6|192):(e+=String.fromCharCode(o>>12|224),e+=String.fromCharCode(o>>6&63|128)),e+=String.fromCharCode(63&o|128))}return e},p=function(t){for(var e,n,o="",i=0,s=0;i<t.length;)(e=t.charCodeAt(i))<128?(o+=String.fromCharCode(e),i++):191<e&&e<224?(s=t.charCodeAt(i+1),o+=String.fromCharCode((31&e)<<6|63&s),i+=2):(s=t.charCodeAt(i+1),n=t.charCodeAt(i+2),o+=String.fromCharCode((15&e)<<12|(63&s)<<6|63&n),i+=3);return o},c={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(t){try{if(window.btoa&&window.atob)return window.btoa(unescape(encodeURIComponent(t)))}catch(t){}return c._encode(t)},_encode:function(t){var e,n,o,i,s,r,a,u="",p=0;for(t=h(t);p<t.length;)i=(e=t.charCodeAt(p++))>>2,s=(3&e)<<4|(n=t.charCodeAt(p++))>>4,r=(15&n)<<2|(o=t.charCodeAt(p++))>>6,a=63&o,isNaN(n)?r=a=64:isNaN(o)&&(a=64),u=u+c._keyStr.charAt(i)+c._keyStr.charAt(s)+c._keyStr.charAt(r)+c._keyStr.charAt(a);return u},decode:function(t){try{if(window.btoa&&window.atob)return decodeURIComponent(escape(window.atob(t)))}catch(t){}return c._decode(t)},_decode:function(t){var e,n,o,i,s,r,a="",u=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<t.length;)e=c._keyStr.indexOf(t.charAt(u++))<<2|(i=c._keyStr.indexOf(t.charAt(u++)))>>4,n=(15&i)<<4|(s=c._keyStr.indexOf(t.charAt(u++)))>>2,o=(3&s)<<6|(r=c._keyStr.indexOf(t.charAt(u++))),a+=String.fromCharCode(e),64!==s&&(a+=String.fromCharCode(n)),64!==r&&(a+=String.fromCharCode(o));return a=p(a)}},d=e,m=t,s={expirationDays:void 0,domain:void 0},a=function(t){try{for(var e=r(t)+"=",n=document.cookie.split(";"),o=null,i=0;i<n.length;i++){for(var s=n[i];" "===s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e)){o=s.substring(e.length,s.length);break}}return o?JSON.parse(c.decode(o)):null}catch(t){return null}},u=function(t,e){try{return o(r(t),c.encode(JSON.stringify(e)),s),!0}catch(t){return!1}},o=function(t,e,n){var o,i=null!==e?n.expirationDays:-1;i&&((o=new Date).setTime(o.getTime()+24*i*60*60*1e3),i=o);var s=t+"="+e;i&&(s+="; expires="+i.toUTCString()),s+="; path=/",n.domain&&(s+="; domain="+n.domain),document.cookie=s},v=function(t){try{return o(r(t),null,s),!0}catch(t){return!1}},g={reset:function(){s={}},options:function(t){if(0===arguments.length)return s;t=t||{},s.expirationDays=t.expirationDays;var e=void 0!==t.domain?t.domain:"."+i(window.location.href),n=Math.random();s.domain=e,u("rakam_test",n);var o=a("rakam_test");o&&o===n||(e=null),v("rakam_test"),s.domain=e},get:a,set:u,remove:v},f={language:navigator&&(navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage)||void 0};if(function(){var t,e=new Date;try{return window.localStorage.setItem(e,e),t=window.localStorage.getItem(e)===String(e),window.localStorage.removeItem(e),t}catch(t){}}())n=window.localStorage;else if(window.globalStorage)try{n=window.globalStorage[window.location.hostname]}catch(t){}else{var y=document.createElement("div"),_="localStorage";y.style.display="none",document.getElementsByTagName("head")[0].appendChild(y),y.addBehavior&&(y.addBehavior("#default#userdata"),n={length:0,setItem:function(t,e){y.load(_),y.getAttribute(t)||this.length++,y.setAttribute(t,e),y.save(_)},getItem:function(t){return y.load(_),y.getAttribute(t)},removeItem:function(t){y.load(_),y.getAttribute(t)&&this.length--,y.removeAttribute(t),y.save(_)},clear:function(){y.load(_);for(var t,e=0;t=y.XMLDocument.documentElement.attributes[e++];)y.removeAttribute(t.name);y.save(_),this.length=0},key:function(t){return y.load(_),y.XMLDocument.documentElement.attributes[t]}},y.load(_),n.length=y.XMLDocument.documentElement.attributes.length)}var b=n=n||{length:0,setItem:function(){},getItem:function(){},removeItem:function(){},clear:function(){},key:function(){}},E={}.hasOwnProperty;function I(t,e){for(var n in e)E.call(e,n)&&(t[n]=e[n]);return t}function k(t,e,n){this.url=t,this.data=e||{},this.headers=n||{}}k.prototype.send=function(t){if(!!window.XDomainRequest){var e=new window.XDomainRequest;e.open("POST",this.url,!0),e.onload=function(){t(e.responseText)},e.send(JSON.stringify(this.data))}else{var n=new XMLHttpRequest;for(var o in n.withCredentials="true",n.open("POST",this.url,!0),n.onreadystatechange=function(){4===n.readyState&&t(n.status,n.responseText,function(t){var e={};if(!t)return e;for(var n=t.split("\r\n"),o=0;o<n.length;o++){var i,s,r=n[o],a=r.indexOf(": ");0<a&&(i=r.substring(0,a),s=r.substring(a+2),e[i]=s)}return e}(n.getAllResponseHeaders()))},n.setRequestHeader("Content-Type","text/plain"),this.headers)this.headers.hasOwnProperty(o)&&n.setRequestHeader(o,this.headers[o]);n.send(JSON.stringify(this.data))}};function S(t){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var w=Object.prototype.toString;function C(t){switch(w.call(t)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===t?"null":void 0===t?"undefined":t!=t?"nan":t&&1===t.nodeType?"element":"undefined"!=typeof Buffer&&Buffer.isBuffer(t)?"buffer":S(t=t.valueOf?t.valueOf():Object.prototype.valueOf.apply(t))}function A(t,e,o){return function(t,e,n){void 0!==o&&o(t,e,n)}}function T(t){return("https:"===window.location.protocol?"https":"http")+"://"+t.apiEndpoint+"/user"}function O(){}O.prototype.init=function(t){this.options=t},O.prototype.set=function(t,e){return new k(T(this.options)+"/set_properties",{api:{api_version:1,api_key:this.options.apiKey},id:this.options.userId,properties:t}).send(A(0,0,e)),this},O.prototype.setOnce=function(t,e){return new k(T(this.options)+"/set_properties_once",{api:{api_version:1,api_key:this.options.apiKey},id:this.options.userId,properties:t}).send(A(0,0,e)),this},O.prototype.increment=function(t,e,n){return new k(T(this.options)+"/increment_property",{api:{api_version:1,api_key:this.options.apiKey},id:this.options.userId,property:t,value:e}).send(A(0,0,n)),this};function N(t,e){return t.useLocalStorageForSessionization?b.getItem(e):g.get(e)}function P(t,e,n){t.useLocalStorageForSessionization?b.setItem(e,n):g.set(e,n)}function x(){this._unsentEvents=[],this.options=I({},U)}var U={apiEndpoint:"managed.getrakam.com",eventEndpointPath:"/event/batch",cookieExpiration:3650,cookieName:"rakam_id",domain:void 0,includeUtm:!(O.prototype.unset=function(t,e){return new k(T(this.options)+"/unset_properties",{api:{api_version:1,api_key:this.options.apiKey},id:this.options.userId,properties:"array"===C(t)?t:[t]}).send(A(0,0,e)),this}),trackForms:!1,language:f.language,optOut:!1,platform:"Web",savedMaxCount:1e3,saveEvents:!0,sessionTimeout:18e5,unsentKey:"rakam_unsent",uploadBatchSize:100,batchEvents:!1,eventUploadThreshold:30,eventUploadPeriodMillis:3e4,useLocalStorageForSessionization:!0},R="rakam_lastEventId",D="rakam_lastEventTime",M="rakam_sessionId",F="rakam_returning";x.prototype._eventId=0,x.prototype._returningUser=!1,x.prototype._sending=!1,x.prototype._lastEventTime=null,x.prototype._sessionId=null,x.prototype._newSession=!1,x.prototype.log=function(t){!0===this.options.debug&&console.log("[Rakam] "+t)},x.prototype.init=function(t,e,n,o){try{if(!t)throw new Error("apiKey is null");this.options.apiKey=t;var i=new O;if(i.init(this.options),this.User=function(){return i},n&&(this.options.apiEndpoint=n.apiEndpoint||this.options.apiEndpoint,this.options.debug=n.debug||!0===this.options.debug,void 0!==n.saveEvents&&(this.options.saveEvents=!!n.saveEvents),void 0!==n.domain&&(this.options.domain=n.domain),void 0!==n.includeUtm&&(this.options.includeUtm=!!n.includeUtm),void 0!==n.trackClicks&&(this.options.trackClicks=!!n.trackClicks),void 0!==n.trackForms&&(this.options.trackForms=!!n.trackForms),void 0!==n.batchEvents&&(this.options.batchEvents=!!n.batchEvents),this.options.platform=n.platform||this.options.platform,this.options.useLocalStorageForSessionization=void 0!==n.useLocalStorageForSessionization?n.useLocalStorageForSessionization:this.options.useLocalStorageForSessionization,this.options.language=n.language||this.options.language,this.options.sessionTimeout=n.sessionTimeout||this.options.sessionTimeout,this.options.uploadBatchSize=n.uploadBatchSize||this.options.uploadBatchSize,this.options.eventUploadThreshold=n.eventUploadThreshold||this.options.eventUploadThreshold,this.options.savedMaxCount=n.savedMaxCount||this.options.savedMaxCount,this.options.eventUploadPeriodMillis=n.eventUploadPeriodMillis||this.options.eventUploadPeriodMillis,this.options.superProperties=n.superProperties||[]),g.options({expirationDays:this.options.cookieExpiration,domain:this.options.domain}),this.options.domain=g.options().domain,q(this),n&&void 0!==n.deviceId&&null!==n.deviceId&&n.deviceId||this.options.deviceId?this.options.deviceId=this.options.deviceId:(this.deviceIdCreatedAt=new Date,this.options.deviceId=function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()),z(this),this.log("initialized with apiKey="+t),this.options.saveEvents){var s=b.getItem(this.options.unsentKey);if(s)try{this._unsentEvents=JSON.parse(s)}catch(t){this.log(t)}}this._sendEventsIfReady(),this.options.includeUtm&&this._initUtmData(),this.options.trackForms&&this._initTrackForms(),this.options.trackClicks&&this._initTrackClicks(),this._lastEventTime=parseInt(N(this.options,D))||null,this._sessionId=parseInt(N(this.options,M))||null,this._eventId=b.getItem(R)||0;var r=(new Date).getTime();!this._sessionId||!this._lastEventTime||r-this._lastEventTime>this.options.sessionTimeout?(null!==this._sessionId&&(P(this.options,F,!0),this._returningUser=!0),this._sessionId=r,P(this.options,M,this._sessionId)):this._returningUser="true"===N(this.options,F),this._lastEventTime=r,P(this.options,D,this._lastEventTime)}catch(t){this.log(t)}this.setUserId(e),o&&"function"==typeof o&&setTimeout(function(){o()},1)},x.prototype.onEvent=function(t){this.options.eventCallbacks=this.options.eventCallbacks||[],this.options.eventCallbacks.push(t)};function L(t,e,n,o){return null!==o&&(o=o.toLowerCase()),"long"===o||"time"===o||"timestamp"===o||"date"===o?(n=parseInt(n),!isNaN(n)&&isFinite(n)||(t.log("ignoring "+e+": the value must be a number"),n=null)):"double"===o?(n=parseFloat(n),!isNaN(n)&&isFinite(n)||(t.log("ignoring "+e+": the value is not double"),n=null)):"boolean"===o&&(n="true"===o||"1"===o||"false"!==o&&"0"!==o&&(t.log("ignoring "+e+": the value is not boolean"),null)),n}x.prototype.logInlinedEvent=function(t,e,n){for(var o=e||{},i=function(t){if(document.querySelectorAll)return document.querySelectorAll("[rakam-event-attribute]");for(var e=[],n=document.getElementsByTagName("*"),o=0,i=n.length;o<i;o++)null!==n[o].getAttribute(t)&&e.push(n[o]);return e}("rakam-event-attribute"),s=0;s<i.length;s++){var r,a=i[s],u=a.getAttribute("rakam-event-attribute"),p=a.getAttribute("rakam-event-attribute-value"),l=a.getAttribute("rakam-event-attribute-type");null===p&&("INPUT"===a.tagName?p=a.value:"SELECT"===a.tagName?null!==(r=a.options[a.selectedIndex]).value&&""!==r.value&&(p="value"!==a.getAttribute("rakam-attribute-value")?r.value:r.text):a.innerText?p=a.innerText.replace(/^\s+|\s+$/g,""):this.log("Could find value of DOM element.",a)),null!==p&&""!==p&&(o[u]=L(this,u,p,l))}this.logEvent(t,o,n)},x.prototype.isReturningUser=function(){return this._returningUser},x.prototype.resetTimer=function(){console.log("[Rakam WARN] rakam.resetTimer function is removed from the API.")},x.prototype.startTimer=function(){console.log("[Rakam WARN] rakam.startTimer function is removed from the API.")},x.prototype.getTimeOnPage=function(){console.log("[Rakam WARN] rakam.getTimeOnPage function is removed from the API.")},x.prototype.getTimeOnPreviousPage=function(){console.log("[Rakam WARN] rakam.getTimeOnPreviousPage function is removed from the API.")},x.prototype.nextEventId=function(){return this._eventId++,this._eventId},x.prototype._sendEventsIfReady=function(t){return 0!==this._unsentEvents.length&&(!this.options.batchEvents||this._unsentEvents.length>=this.options.eventUploadThreshold?(this.sendEvents(t),!0):(setTimeout(this.sendEvents.bind(this),this.options.eventUploadPeriodMillis),!1))};var q=function(t){var e=g.get(t.options.cookieName);e&&(e.deviceId&&(t.options.deviceId=e.deviceId),e.userId&&(t.options.userId=e.userId),e.superProps&&(t.options.superProperties=e.superProps),void 0!==e.optOut&&(t.options.optOut=e.optOut),void 0!==e.deviceIdCreatedAt&&(t.deviceIdCreatedAt=new Date(parseInt(e.deviceIdCreatedAt))))},z=function(t){g.set(t.options.cookieName,{deviceId:t.options.deviceId,deviceIdCreatedAt:t.deviceIdCreatedAt?t.deviceIdCreatedAt.getTime():void 0,userId:t.options.userId,superProps:t.options.superProperties,optOut:t.options.optOut})};x._getUtmParam=function(t,e){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null===n?void 0:decodeURIComponent(n[1].replace(/\+/g," "))},x._getUtmData=function(t,e){function n(t,e,n,o){return x._getUtmParam(t,e)||x._getUtmParam(n,o)}var o=t?"?"+t.split(".").slice(-1)[0].replace(/\|/g,"&"):"";return{utm_source:n("utm_source",e,"utmcsr",o),utm_medium:n("utm_medium",e,"utmcmd",o),utm_campaign:n("utm_campaign",e,"utmccn",o),utm_term:n("utm_term",e,"utmctr",o),utm_content:n("utm_content",e,"utmcct",o)}},x.prototype._initUtmData=function(t,e){t=t||location.search,e=e||g.get("__utmz"),this._utmProperties=x._getUtmData(e,t)},x.prototype._initTrackForms=function(){var h=this;document.addEventListener("submit",function(t){var e=t.target||t.srcElement,n=e.getAttribute("rakam-event-form");if("FORM"===e.tagName&&n){var o={},i=e.getAttribute("rakam-event-extra");if(null!==i)for(var s in JSON.parse(i))i.hasOwnProperty(s)&&(o[s]=i[s]);for(var r=0;r<e.elements.length;r++){var a,u,p=e.elements[r],l=p.getAttribute("rakam-event-attribute-type");p.hasAttribute("type")&&(a=p.getAttribute("type").toLowerCase()),"password"!==a&&(null===l&&"INPUT"===p.tagName&&"number"===a&&(l="long"),p.hasAttribute("rakam-event-form-element-ignore")||(u=p.hasAttribute("rakam-event-attribute")?p.getAttribute("rakam-event-attribute"):p.getAttribute("name"),p.hasAttribute("rakam-event-attribute-value")?o[u]=L(this,u,p.getAttribute("rakam-event-attribute-value"),l):"SELECT"===p.tagName?o[u]=L(this,u,p.options[p.selectedIndex].value,l):"INPUT"===p.tagName||"TEXTAREA"===p.tagName?o[u]=L(this,u,p.value,l):h.log("Couldn't get value of form element: "+u)))}h.logEvent(n,o)}})},x.prototype._initTrackClicks=function(){var r=this;document.addEventListener("click",function(t){var e=t.target||t.srcElement,n=e.getAttribute("rakam-event-track");if("FORM"===e.tagName&&n){var o={},i=e.getAttribute("rakam-event-properties");if(null!==i)for(var s in JSON.parse(i))i.hasOwnProperty(s)&&(o[s]=i[s]);r.logEvent(n,o)}})},x.prototype.saveEvents=function(){try{b.setItem(this.options.unsentKey,JSON.stringify(this._unsentEvents))}catch(t){this.log(t)}},x.prototype.setDomain=function(t){try{g.options({domain:t}),this.options.domain=g.options().domain,q(this),z(this),this.log("set domain="+t)}catch(t){this.log(t)}},x.prototype.setUserId=function(t){try{this.options.userId=null!=t&&""+t||null,z(this),this.log("set userId="+t)}catch(t){this.log(t)}},x.prototype.setUserProperties=function(t){try{return(new this.User).set(t)}catch(t){this.log(t)}},x.prototype.getUserId=function(){return this.options.userId},x.prototype.getDeviceId=function(){return 0<this._eventId?this.options.deviceId:null},x.prototype.setOptOut=function(t){try{this.options.optOut=t,z(this),this.log("set optOut="+t)}catch(t){this.log(t)}},x.prototype.setDeviceId=function(t){try{t&&(this.options.deviceId=""+t,z(this))}catch(t){this.log(t)}},x.prototype.setSuperProperties=function(t,e){try{for(var n in this.options.superProperties=this.options.superProperties||{},t)if(t.hasOwnProperty(n)){if(!1===e&&void 0!==this.options.superProperties[n])continue;this.options.superProperties[n]=t[n]}z(this),this.log("set super properties="+JSON.stringify(t))}catch(t){this.log(t)}},x.prototype.setVersionName=function(t){try{this.options.versionName=t,this.log("set versionName="+t)}catch(t){this.log(t)}},x.prototype._logEvent=function(t,e,n,o){if("function"!=typeof o&&(o=null),t&&!this.options.optOut)try{var i=(new Date).getTime(),s=this.nextEventId();this._sessionId&&this._lastEventTime&&!(i-this._lastEventTime>this.options.sessionTimeout)||(this._sessionId=i,P(this.options,M,this._sessionId)),this._lastEventTime=i,P(this.options,D,this._lastEventTime),P(this.options,R,s),n=n||{},I(e=e||{},this._utmProperties);var r={collection:t,properties:{_device_id:this.options.deviceId,_user:this.options.userId,_time:1e3*parseInt(i/1e3),_session_id:this._sessionId||-1,_platform:this.options.platform,_language:this.options.language}};return I(r.properties,this.options.superProperties),I(r.properties,n),I(r.properties,e),this.log("logged eventType="+t+", properties="+JSON.stringify(e)),this._unsentEvents.push({id:s,event:r}),this._unsentEvents.length>this.options.savedMaxCount&&this._unsentEvents.splice(0,this._unsentEvents.length-this.options.savedMaxCount),this.options.saveEvents&&this.saveEvents(),!this._sendEventsIfReady(o)&&o&&o(0,"No request sent"),s}catch(t){this.log(t)}else o&&o(0,"No request sent")},x.prototype.logEvent=function(t,e,n){return this._logEvent(t,e,null,n)},x.prototype.removeEvents=function(t,e){for(var n=[],o=e||[],i=0;i<this._unsentEvents.length;i++){var s=this._unsentEvents[i].id;(-1<o.indexOf(s)||t<s)&&n.push(this._unsentEvents[i])}this._unsentEvents=n},x.prototype.sendEvents=function(i){var t,s,r,e,n,a,u=this;!this._sending&&!this.options.optOut&&0<this._unsentEvents.length?(this._sending=!0,t=("https:"===window.location.protocol?"https":"http")+"://"+this.options.apiEndpoint+this.options.eventEndpointPath,s=Math.min(this._unsentEvents.length,this.options.uploadBatchSize),r=this._unsentEvents[s-1].id,this._unsentEvents.slice(0,s),e=this._unsentEvents.slice(0,s).map(function(t){return t.event}),n={upload_time:(new Date).getTime(),api_version:1,api_key:this.options.apiKey},a=this,new k(t,{api:n,events:e}).send(function(t,e,n){a._sending=!1;try{200===t||409===t?(u.log("successful upload"),a.removeEvents(r,409===t?JSON.parse(e):null),a.options.saveEvents&&a.saveEvents(),!a._sendEventsIfReady(i)&&i&&i(t,e)):413===t?(u.log("request too large"),1===a.options.uploadBatchSize&&a.removeEvents(r),a.options.uploadBatchSize=Math.ceil(s/2),a.sendEvents(i)):i&&i(t,e)}catch(t){u.log("failed upload")}if(a.options.eventCallbacks)try{for(var o=0;o<a.options.eventCallbacks.length;o++)a.options.eventCallbacks[o](t,e,n)}catch(t){u.log("callback throws an exception",t)}})):i&&i(0,"No request sent")},x.prototype.onload=function(t){var e=this;setTimeout(function(){t(),e.log("executed callback",t)},1)},x.prototype.runQueuedFunctions=function(){for(var t=0;t<this._q.length;t++){var e=this[this._q[t][0]];e&&"function"===C(e)&&e.apply(this,this._q[t].slice(1))}this._q=[]},x.prototype.__VERSION__="2.6.0";var B=window.rakam||{},J=new x;return J._q=B._q||[],J});