SP/web2py/applications/examples/static/js/analytics.min.js

4 lines
12 KiB
JavaScript
Raw Normal View History

2018-10-25 15:33:07 +00:00
// Analytics.js 0.2.2
// (c) 2012 Segment.io Inc.
// Analytics.js may be freely distributed under the MIT license.
(function(){var e={userId:null,date:new Date,loaded:!1,initialized:!1,initializableProviders:{},providers:[],addProvider:function(e,t){this.initializableProviders[e]=t},initialize:function(e){this.providers=[],this.userId=null;for(var t in e){var n=this.initializableProviders[t],r=e[t];if(!n)throw new Error('Could not find a provider named "'+t+'"');n.initialize(r),this.providers.push(n)}this.initialized=!0;var i=this.utils.getUrlParameter(window.location.search,"ajs_uid");i&&this.identify(i);var s=this.utils.getUrlParameter(window.location.search,"ajs_event");s&&this.track(s)},identify:function(e,t){if(!this.initialized)return;this.utils.isObject(e)&&(t=e,e=null),e!==null?this.userId=e:e=this.userId;for(var n=0,r;r=this.providers[n];n++){if(!r.identify)continue;r.identify(e,this.utils.clone(t))}},track:function(e,t){if(!this.initialized)return;for(var n=0,r;r=this.providers[n];n++){if(!r.track)continue;r.track(e,this.utils.clone(t))}},pageview:function(){if(!this.initialized)return;for(var e=0,t;t=this.providers[e];e++){if(!t.pageview)continue;t.pageview()}},utils:{getSeconds:function(e){return Math.floor(new Date(e)/1e3)},clone:function(e){if(!e)return;var t={};for(var n in e)t[n]=e[n];return t},extend:function(e){var t=Array.prototype.slice.call(arguments,1);for(var n=0,r;r=t[n];n++)for(var i in r)e[i]=r[i];return e},alias:function(e,t){for(var n in t){var r=t[n];e[n]!==undefined&&(e[r]=e[n],delete e[n])}},isObject:function(e){return e===Object(e)},isString:function(e){return Object.prototype.toString.call(e)==="[object String]"},isFunction:function(e){return Object.prototype.toString.call(e)==="[object Function]"},isNumber:function(e){return Object.prototype.toString.call(e)==="[object Number]"},isEmail:function(e){return/.+\@.+\..+/.test(e)},resolveSettings:function(e,t){if(!this.isString(e)&&!this.isObject(e))throw new Error("Could not resolve settings.");if(!t)throw new Error("You must provide an api key field name.");if(this.isString(e)){var n=e;e={},e[t]=n}return e},getUrlParameter:function(e,t){var n=e.replace("?","").split("&");for(var r=0;r<n.length;r+=1){var i=n[r].split("=");if(i.length===2&&i[0]===t)return decodeURIComponent(i[1])}}}},t=window.onload;window.onload=function(){e.loaded=!0,e.utils.isFunction(t)&&t()},window.analytics=e})(),analytics.addProvider("Chartbeat",{settings:{domain:null,uid:null},initialize:function(e){e=analytics.utils.resolveSettings(e,"uid"),analytics.utils.extend(this.settings,e);var t=this.settings||{};(function(){window._sf_endpt=analytics.date.getTime();var e=document.createElement("script");e.setAttribute("language","javascript"),e.setAttribute("type","text/javascript"),e.setAttribute("src",("https:"==document.location.protocol?"https://a248.e.akamai.net/chartbeat.download.akamai.com/102508/":"http://static.chartbeat.com/")+"js/chartbeat.js"),document.body.appendChild(e)})()},pageview:function(){window.pSUPERFLY.virtualPage(window.location.pathname)}}),analytics.addProvider("CrazyEgg",{settings:{apiKey:null},initialize:function(e){e=analytics.utils.resolveSettings(e,"apiKey"),analytics.utils.extend(this.settings,e),function(){var e=document.createElement("script"),t=document.getElementsByTagName("script")[0];e.src=document.location.protocol+"//dnn506yrbagrg.cloudfront.net/pages/scripts/"+this.settings.apiKey+".js?"+Math.floor((new Date).getTime()/36e5),e.async=!0,e.type="text/javascript",t.parentNode.insertBefore(e,t)}()}}),analytics.addProvider("Customer.io",{settings:{siteId:null},initialize:function(e){e=analytics.utils.resolveSettings(e,"siteId"),analytics.utils.extend(this.settings,e);var t=this,n=window._cio=n||[];(function(){var e,r,i;e=function(e){return function(){n.push([e].concat(Array.prototype.slice.call(arguments,0)))}},r=["identify","track"];for(i=0;i<r.length;i++)n[r[i]]=e(r[i]);var s=document.createElement("script"),o=document.getElementsByTagName("script")[0];s.async=!0,s.id="cio-tracker",s.setAttribute("data-site-id",t.settings.siteId),s.src="https://assets.customer.io/assets/track.js",o.parentNode.insertBefore(s,o)})()},identify:function(e,t){if(!e)return