var website_analytics = { time: [0,0], c : [], init(){ this.c.push('ul=' + encodeURIComponent(window.location.href)); this.c.push('ru=' + encodeURIComponent(document.referrer)); this.c.push('rr=' + this.referrer()); this.c.push('rd=' + this.domain()); this.c.push('br=' + this.browser()); this.c.push('im=' + this.is_mobile()); this.c.push('ct=' + this.client()); this.c.push('lk=' + this.link()); this.c.push('_=' + Math.random()); (new Image).src = '/gateway/open/analytics/a?' + this.c.join('&'); }, browser() { const userAgent = navigator.userAgent.toLowerCase(); if (userAgent.includes('msie') || userAgent.includes('trident')) return 'IE'; if (userAgent.includes('firefox')) return 'firefox'; if (userAgent.includes('ubrowser')) return 'UC'; if (userAgent.includes('opera')) return 'opera'; if (userAgent.includes('bidubrowser')) return 'baidu'; if (userAgent.includes('metasr')) return 'sogou'; if (userAgent.includes('tencenttraveler') || userAgent.includes('qqbrowser')) return 'QQ'; if (userAgent.includes('micromessenger')) return 'WeChat'; if (userAgent.includes('maxthon')) return 'maxthon'; if (userAgent.includes('chrome')) { // Check for 360 browser if (navigator.mimeTypes['application/360softmgrplugin']) { return '360'; } return 'chrome'; } if (userAgent.includes('safari')) return 'Safari'; return 'unknown'; }, is_mobile() { var ua = navigator.userAgent.toLocaleLowerCase(); var isPhone = /mobile/i.test(ua) == true ? 1 : 0; return isPhone }, client() { var ua = navigator.userAgent.toLocaleLowerCase(); var isPhone = /mobile/i.test(ua); var type = ''; if (isPhone) { if (ua.indexOf('android') > -1 || ua.indexOf('linux') > -1) { type = "Android" } else if (ua.indexOf('iPhone') > -1) { type = "iPhone" } else if (ua.indexOf('ipad') > -1) { type = "iPad" } else { type = "other" } } else { type = 'PC' } return type }, referrer() { var host = window.location.host; var ref = this.domain(); var res = ''; if (ref) { if (ref == 'www.baidu.com') { res = 'baidu' } else if (ref == 'm.sm.cn') { res = 'shenma' } else if (ref == 'www.so.com') { res = '360' } else if (ref == 'www.sogou.com') { res = 'sogou' } else if (ref == 'www.google.com') { res = 'Google' } else if (ref == 'quark.sm.cn') { res = 'quark' } else if (ref == 'www.toutiao.com') { res = 'toutiao' } else if (ref == host || ref == 'www.' + host || 'www.' + ref == host) { res = 'direct' } else { res = 'indirect' } } else { res = 'direct' } return res }, domain() { var referrer = document.referrer; var ref = (referrer || '').match(/https?:\/\/([^\/]+)\//i); var domain = ref ? ref[1] : ''; if (domain.search(/^(baidu\.com|so\.com|sogou\.com|google\.com|toutiao\.com)$/) == 0) { domain = 'www.' + domain } return domain }, link(str) { var link = str || window.location.href; var res = link.match(/^(https?:\/\/[^\/]+)?([^\?]*)([\S\s]*)$/i)[2]; res = res.replace(/(\.[^\.]+)$/, '').replace(/\/+/, '/').replace(/\/+$/, ''); if (!res) { res = '/' } return res } }; website_analytics.init(); // 璁$畻鍋滅暀鏃堕棿 website_analytics.time[0] = Date.now(); window.addEventListener('beforeunload', (event) => { // 鍦ㄨ繖閲屾墽琛屼綘闇€瑕佺殑浠讳綍娓呯悊鎿嶄綔锛屾瘮濡傚彂閫佺粺璁℃暟鎹瓑 // 渚嬪锛屽彂閫佷竴涓狿OST璇锋眰鍒版湇鍔″櫒璁板綍鐢ㄦ埛鐨勭寮€鏃堕棿 website_analytics.time[1] = Date.now(); let param = []; param.push('ul=' + encodeURIComponent(window.location.href)); param.push('lk=' + website_analytics.link(window.location.href)); param.push('stay=' + Math.ceil((website_analytics.time[1] - website_analytics.time[0])/1000)); param.push('_=' + Math.random()); navigator.sendBeacon('/gateway/open/analytics/stay?' + param.join('&')); });