SP/web2py/applications/admin/static/js/analytics.min.js
Saturneic 064f602b1a Add.
2018-10-25 23:33:13 +08:00

4 lines
12 KiB
JavaScript

// 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;t||(t={}),t.id=e,!t.email&&analytics.utils.isEmail(e)&&(t.email=e),t.created&&(t.created_at=analytics.utils.getSeconds(t.created),delete t.created),window._cio.identify(t)},track:function(e,t){window._cio.track(e,t)}}),analytics.addProvider("Google Analytics",{settings:{anonymizeIp:!1,enhancedLinkAttribution:!1,siteSpeedSampleRate:null,trackingId:null},initialize:function(e){e=analytics.utils.resolveSettings(e,"trackingId"),analytics.utils.extend(this.settings,e);var t=t||[];t.push(["_setAccount",this.settings.trackingId]);if(this.settings.enhancedLinkAttribution){var n=("https:"==document.location.protocol?"https://www.":"http://www.")+"google-analytics.com/plugins/ga/inpage_linkid.js";t.push(["_require","inpage_linkid",n])}analytics.utils.isNumber(this.settings.siteSpeedSampleRate)&&t.push(["_setSiteSpeedSampleRate",this.settings.siteSpeedSampleRate]),this.settings.anonymizeIp&&t.push(["_gat._anonymizeIp"]),t.push(["_trackPageview"]),window._gaq=t,function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()},track:function(e,t){window._gaq.push(["_trackEvent","All",e])},pageview:function(){window._gaq.push(["_trackPageview"])}}),analytics.addProvider("HubSpot",{settings:{portalId:null},initialize:function(e){e=analytics.utils.resolveSettings(e,"portalId"),analytics.utils.extend(this.settings,e);var t=this;(function(e,n,r,i){if(e.getElementById(r))return;window._hsq=window._hsq||[];var s=e.createElement(n),o=e.getElementsByTagName(n)[0];s.id=r,s.src="https://js.hubspot.com/analytics/"+Math.ceil(new Date/i)*i+"/"+t.settings.portalId+".js",o.parentNode.insertBefore(s,o)})(document,"script","hs-analytics",3e5)},identify:function(e,t){if(!t)return;window._hsq.push(["identify",t])},track:function(e,t){window._hsq.push(["trackEvent",e,t])},pageview:function(){}}),analytics.addProvider("GoSquared",{settings:{siteToken:null},initialize:function(e){e=analytics.utils.resolveSettings(e,"siteToken"),analytics.utils.extend(this.settings,e);var t=window.GoSquared={};t.acct=this.settings.siteToken,window._gstc_lt=+(new Date);var n=document,r=n.createElement("script");r.type="text/javascript",r.async=!0,r.src="//d1l6p2sc9645hc.cloudfront.net/tracker.js";var i=n.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)},identify:function(e,t){e&&(window.GoSquared.UserName=e),t&&(window.GoSquared.Visitor=t)},track:function(e,t){window.GoSquared.q||(window.GoSquared.q=[]),t||(t={}),window.GoSquared.q.push(["TrackEvent",e,t])},pageview:function(){window.GoSquared.DefaultTracker.TrackView()}}),analytics.addProvider("Intercom",{settings:{appId:null},initialize:function(e){e=analytics.utils.resolveSettings(e,"appId"),analytics.utils.extend(this.settings,e)},identify:function(e,t){function n(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://api.intercom.io/api/js/library.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}if(!e)return;window.intercomSettings={app_id:this.settings.appId,user_id:e,user_hash:this.settings.userHash,custom_data:t||{}},t&&(window.intercomSettings.email=t.email,window.intercomSettings.name=t.name,window.intercomSettings.created_at=analytics.utils.getSeconds(t.created)),analytics.utils.isEmail(e)&&t&&!t.email&&(window.intercomSettings.email=e),window.attachEvent?window.attachEvent("onload",n):window.addEventListener("load",n,!1)}}),analytics.addProvider("KISSmetrics",{settings:{apiKey:null},initialize:function(e){function n(e){setTimeout(function(){var t=document,n=t.getElementsByTagName("script")[0],r=t.createElement("script");r.type="text/javascript",r.async=!0,r.src=e,n.parentNode.insertBefore(r,n)},1)}e=analytics.utils.resolveSettings(e,"apiKey"),analytics.utils.extend(this.settings,e);var t=t||[];window._kmq=t,n("//i.kissmetrics.com/i.js"),n("//doug1izaerwt3.cloudfront.net/"+this.settings.apiKey+".1.js")},identify:function(e,t){e&&window._kmq.push(["identify",e]),t&&window._kmq.push(["set",t])},track:function(e,t){window._kmq.push(["record",e,t])}}),analytics.addProvider("Klaviyo",{settings:{apiKey:null},initialize:function(e){e=analytics.utils.resolveSettings(e,"apiKey"),analytics.utils.extend(this.settings,e);var t=t||[];t.push(["account",this.settings.apiKey]),window._learnq=t,function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=("https:"==document.location.protocol?"https://":"http://")+"a.klaviyo.com/media/js/learnmarklet.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()},identify:function(e,t){t||(t={}),e&&(t.$id=e),window._learnq.push(["identify",t])},track:function(e,t){window._learnq.push(["track",e,t])}}),analytics.addProvider("Mixpanel",{settings:{nameTag:!0,people:!1,token:null},initialize:function(e){e=analytics.utils.resolveSettings(e,"token"),analytics.utils.extend(this.settings,e),function(e,t){window.mixpanel=t;var n,r,i,s;n=e.createElement("script"),n.type="text/javascript",n.async=!0,n.src=("https:"===e.location.protocol?"https:":"http:")+"//cdn.mxpnl.com/libs/mixpanel-2.1.min.js",r=e.getElementsByTagName("script")[0],r.parentNode.insertBefore(n,r),t._i=[],t.init=function(e,n,r){function o(e,t){var n=t.split(".");2==n.length&&(e=e[n[0]],t=n[1]),e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}}var u=t;"undefined"!=typeof r?u=t[r]=[]:r="mixpanel",u.people=u.people||[],i=["disable","track","track_pageview","track_links","track_forms","register","register_once","unregister","identify","name_tag","set_config","people.identify","people.set","people.increment"];for(s=0;s<i.length;s++)o(u,i[s]);t._i.push([e,n,r])},t.__SV=1.1}(document,window.mixpanel||[]),window.mixpanel.init(this.settings.token,this.settings)},identify:function(e,t){e&&analytics.utils.isEmail(e)&&t&&!t.email&&(t||(t={}),t.email=e),t&&analytics.utils.alias(t,{email:"$email",name:"$name",username:"$username",lastSeen:"$lastSeen",created:"$created"}),e&&(window.mixpanel.identify(e),this.settings.nameTag&&window.mixpanel.name_tag(e),this.settings.people&&window.mixpanel.people.identify(e)),t&&(window.mixpanel.register(t),this.settings.people&&window.mixpanel.people.set(t))},track:function(e,t){window.mixpanel.track(e,t)},pageview:function(){window.mixpanel.track_pageview()}}),analytics.addProvider("Olark",{settings:{siteId:null,track:!1,pageview:!0},initialize:function(e){e=analytics.utils.resolveSettings(e,"siteId"),analytics.utils.extend(this.settings,e),window.olark||function(e){var t=window,n=document,r=t.location.protocol=="https:"?"https:":"http:",i=e.name,s="load",o=function(){function h(){u.P(s),t[i](s)}t[i]=function(){(u.s=u.s||[]).push(arguments)};var u=t[i]._={},a=e.methods.length;while(a--)(function(e){t[i][e]=function(){t[i]("call",e,arguments)}})(e.methods[a]);u.l=e.loader,u.i=o,u.p={0:+(new Date)},u.P=function(e){u.p[e]=new Date-u.p[0]},t.addEventListener?t.addEventListener(s,h,!1):t.attachEvent("on"+s,h);var p=function(){function t(e){return e="head",["<",e,"></",e,"><",s,' onload="var d=',y,";d.getElementsByTagName('head')[0].",a,"(d.",f,"('script')).",h,"='",r,"//",u.l,"'",'"',"></",s,">"].join("")}var s="body",o=n[s];if(!o)return setTimeout(p,100);u.P(1);var a="appendChild",f="createElement",h="src",v=n[f]("div"),m=v[a](n[f](i)),g=n[f]("iframe"),y="document",b="domain",w;v.style.display="none",o.insertBefore(v,o.firstChild).id=i,g.frameBorder="0",g.id=i+"-loader",/MSIE[ ]+6/.test(navigator.userAgent)&&(g.src="javascript:false"),g.allowTransparency="true",m[a](g);try{g.contentWindow[y].open()}catch(E){e[b]=n[b],w="javascript:var d="+y+".open();d.domain='"+n.domain+"';",g[h]=w+"void(0);"}try{var S=g.contentWindow[y];S.write(t()),S.close()}catch(x){g[h]=w+'d.write("'+t().replace(/"/g,String.fromCharCode(92)+'"')+'");d.close();'}u.P(2)};p()};o()}({loader:"static.olark.com/jsclient/loader0.js",name:"olark",methods:["configure","extend","declare","identify"]}),window.olark.identify(this.settings.siteId)},identify:function(e,t){var n=e;t&&t.email&&(n=t.email),t&&t.name&&(n=t.name),t&&t.name&&t.email&&(n+=" ("+t.email+")");if(!n)return;window.olark("api.chat.updateVisitorNickname",{snippet:n})},track:function(e,t){if(!this.settings.track)return;window.olark("api.chat.sendNotificationToOperator",{body:'visitor triggered "'+e+'"'})},pageview:function(){if(!this.settings.pageview)return;window.olark("api.chat.sendNotificationToOperator",{body:"looking at "+window.location.href})}});