1// mixpanel Tracking code for elastos.dev 2(function (c, a) { 3 if (!a.__SV) { 4 var b = window; try { var d, m, j, k = b.location, f = k.hash; d = function (a, b) { return (m = a.match(RegExp(b + "=([^&]*)"))) ? m[1] : null }; f && d(f, "state") && (j = JSON.parse(decodeURIComponent(d(f, "state"))), "mpeditor" === j.action && (b.sessionStorage.setItem("_mpcehash", f), history.replaceState(j.desiredHash || "", c.title, k.pathname + k.search))) } catch (n) { } var l, h; window.mixpanel = a; a._i = []; a.init = function (b, d, g) { 5 function c(b, i) { 6 var a = i.split("."); 2 == a.length && (b = b[a[0]], i = a[1]); b[i] = function () { 7 b.push([i].concat(Array.prototype.slice.call(arguments, 8 0))) 9 } 10 } var e = a; "undefined" !== typeof g ? e = a[g] = [] : g = "mixpanel"; e.people = e.people || []; e.toString = function (b) { var a = "mixpanel"; "mixpanel" !== g && (a += "." + g); b || (a += " (stub)"); return a }; e.people.toString = function () { return e.toString(1) + ".people (stub)" }; l = "get_distinct_id disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" "); 11 for (h = 0; h < l.length; h++)c(e, l[h]); var f = "set set_once union unset remove delete".split(" "); e.get_group = function () { function a(c) { b[c] = function () { call2_args = arguments; call2 = [c].concat(Array.prototype.slice.call(call2_args, 0)); e.push([d, call2]) } } for (var b = {}, d = ["get_group"].concat(Array.prototype.slice.call(arguments, 0)), c = 0; c < f.length; c++)a(f[c]); return b }; a._i.push([b, d, g]) 12 }; a.__SV = 1.2; b = c.createElement("script"); b.type = "text/javascript"; b.async = !0; b.src = "undefined" !== typeof MIXPANEL_CUSTOM_LIB_URL ? 13 MIXPANEL_CUSTOM_LIB_URL : "file:" === c.location.protocol && "//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//) ? "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js" : "//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js"; d = c.getElementsByTagName("script")[0]; d.parentNode.insertBefore(b, d) 14 } 15})(document, window.mixpanel || []); 16 17mixpanel.init("df164f13212cbb0dfdae991da60e87f2", { batch_requests: true }) 18// super event property 19mixpanel.register({ 'timestamp': new Date().toString(), '$referrer': document.referrer }); 20 21window.addEventListener("load", function () { 22 23 //user profile setting 24 let id = mixpanel.get_distinct_id(); 25 mixpanel.identify(id); 26 mixpanel.people.set_once({ 'first_touch_source': document.referrer, 'date_of_first_touch': new Date().toString() }); 27 28 // track and get duration for all pages 29 mixpanel.track('Viewed Page', { 'page': window.location.pathname }); 30 mixpanel.time_event('Viewed Page'); 31 32 // track links 33 mixpanel.track_links("a", "Link Click", { 'page': window.location.pathname }); 34 35 // track copied code 36 const copyCode = () => { 37 mixpanel.track("Copied code", { 'page': window.location.pathname }) 38 mixpanel.people.increment("copy_code") 39 } 40 41 let copyButtons = document.querySelectorAll("button") 42 for (let i = 0; i < copyButtons.length; i++) { 43 copyButtons[i].onclick = copyCode; 44 } 45 46 // search box 47 let input = document.querySelector('button.DocSearch'); 48 let time = 0 49 input.addEventListener('input', function (event) { 50 clearTimeout(time); 51 time = setTimeout(function () { 52 trackSearch(event) 53 }, 1000); 54 }); 55 function trackSearch(event) { 56 let value = event.target.value; 57 if (value !== "") { 58 mixpanel.people.increment('search') 59 mixpanel.track("Search the docs", { 'content': value }) 60 } 61 } 62 63 // UTM 64 function getQueryParam(url, param) { 65 // Expects a raw URL 66 param = param.replace(/[[]/, "\[").replace(/[]]/, "\]"); 67 let regexS = "[\?&]" + param + "=([^&#]*)" 68 let regex = new RegExp(regexS) 69 let results = regex.exec(url) 70 if (results === null || (results && typeof (results[1]) !== 'string' && results[1].length)) { 71 return ''; 72 } 73 return decodeURIComponent(results[1]).replace(/\W/gi, ' '); 74 } 75 76 function campaignParams() {
77 var campaign_keywords = 'utm_source utm_medium utm_campaign utm_content utm_term'.split(' ') 78 , kw = '' 79 , params = {} 80 , first_params = {}; 81 var index; 82 for (index = 0; index < campaign_keywords.length; ++index) { 83 kw = getQueryParam(document.URL, campaign_keywords[index]); 84 if (kw.length) { 85 params[campaign_keywords[index] + ' [last touch]'] = kw; 86 } 87 } 88 for (index = 0; index < campaign_keywords.length; ++index) { 89 kw = getQueryParam(document.URL, campaign_keywords[index]); 90 if (kw.length) { 91 first_params[campaign_keywords[index] + ' [first touch]'] = kw; 92 } 93 } 94 mixpanel.people.set(params); 95 mixpanel.people.set_once(first_params); 96 mixpanel.register(params); 97 } 98 99 campaignParams() 100});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.