var XCWEBLOG_FirstTime='2021-01-21 13:57:53'; var XCWEBLOG_ID='0eec39bf7d654782aa956266fc3e84f7'; var XCWEBLOG_IP='3.239.109.55'; var XCWEBLOG_BACKWARD_IP='172.17.0.179'; var XCLOGALL_IP='';
//日志收集JS V1.1 fangxc 2015-10-01
if (typeof(XCWEBLOG_ISRUN) != "undefined") {
XCWEBLOG_ISRUN = 'YES_RUN';
} else {
XCWEBLOG_ISRUN = 'NO_RUN';
}
var BrowserDetect = {
init: function() {
this.browser = this.searchString(this.dataBrowser) || "unknownbrowser";
this.version = this.searchVersion(navigator.userAgent.toLowerCase()) ||
this.searchVersion(navigator.appVersion.toLowerCase()) ||
"";
this.OS = this.searchString(this.dataOS) || "unknownOS";
},
searchString: function(data) {
var dataString = navigator.userAgent.toLowerCase();
for (var i = 0; i < data.length; i++) {
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
} else if (dataProp)
return data[i].identity;
}
return undefined;
},
searchVersion: function(dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return undefined;
return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
},
dataBrowser: [{ subString: "360se", identity: "360se" }, {
subString: "msie",
identity: "ie",
versionSearch: "msie"
}, { subString: "chrome", identity: "chrome" }, { subString: "firefox", identity: "firefox" }, {
subString: "safari",
identity: "safari",
versionSearch: "version"
}, { subString: "opera", identity: "opera", versionSearch: "version" }, {
subString: "icab",
identity: "icab"
}, { subString: "omniweb", versionSearch: "omniWeb/", identity: "omniweb" }, {
subString: "kde",
identity: "Konqueror"
}, { subString: "camino", identity: "camino" }, { subString: "netscape", identity: "netscape" }, {
subString: "gecko",
identity: "Mozilla",
versionSearch: "rv"
}, { subString: "mozilla", identity: "Netscape", versionSearch: "mozilla" }],
dataOS: [{ subString: "windows phone", identity: "winphone" }, {
subString: "windows mobile",
identity: "winmobile"
}, { subString: "win", identity: "win" }, { subString: "iphone", identity: "iphone" }, {
subString: "ipad",
identity: "ipad"
}, { subString: "android", identity: "android" }, { subString: "mac", identity: "mac" }, {
subString: "linux",
identity: "linux"
}, { subString: "blackberry", identity: "blackberry" }, { subString: "hp", identity: "webos " }, {
subString: "symbian",
identity: "symbian"
}]
};
var XC_LOG = {
domain: "g.yccdn.com",
customDomain: "c.yccdn.com",
dCur: new Date().getTime(),
//用户cookie名
ckname: 'xc_id',
//特殊字符替换规则
RE: {
"%09": /\t/g,
"%20": / /g,
"%23": /\#/g,
"%26": /\&/g,
"%2B": /\+/g,
"%3F": /\?/g,
"%5C": /\\/g,
"%22": /\"/g,
"%7F": /\x7F/g,
"%A0": /\xA0/g
},
I18NRE: { "%25": /\%/g },
//系统信息收集数据容器
DC: null,
//编码
xcEncode: function(S) {
return (typeof(encodeURIComponent) == "function") ? encodeURIComponent(S) : escape(S);
},
//替换特殊字符
xcEscape: function(S, REL) {
if (window.RegExp && typeof(REL) != "undefined") {
var retStr = new String(S);
for (var R in REL) {
retStr = retStr.replace(REL[R], R);
}
return retStr;
} else {
return escape(S);
}
},
//判断是否需要通知异常COOKIEID
CheckExceptionCookieID: function() {
var url = window.document.referrer;
var host = '';
if (typeof url == "undefined" ||
null == url) {
return 0;
}
var regex = /.*\:\/\/([^\/]*).*/;
var match = url.match(regex);
if (typeof match != "undefined" &&
null != match) {
host = match[1];
} else {
return 0;
}
if (host == "weburl.cool838.cn") {
var urlImg = "http://cdn.partner.bitauto.com/cookieblack/handle.ashx?cid=" + XCWEBLOG_ID + "&it=yc";
document.write('
');
}
return 0;
},
//系统变量收集
DCInit: function() {
this.DC = new Object();
//时间
this.DC.da = this.dCur;
//获取页面referrer
if ((window.document.referrer != "") && (window.document.referrer != "-")) {
this.CheckExceptionCookieID();
if (!(navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) < 4)) {
this.DC.ref = this.xcEscape(window.document.referrer, this.I18NRE);
}
}
//获取页面url
if ((window.location.href != "") && (window.location.href != "-")) {
if (!(navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) < 4)) {
this.DC.url = this.xcEscape(window.location.href, this.I18NRE);
}
}
//是否支持JS
this.DC.js = 'Yes';
//编码方式
this.DC.em = (typeof(encodeURIComponent) == "function") ? "uri" : "esc";
},
CookieEnable: function() {
var result = false;
if (navigator.cookiesEnabled) return true;
document.cookie = "XCWEBLOG_testcookie=yes;";
if (document.cookie.indexOf("XCWEBLOG_testcookie=yes") > -1) {
result = true;
var date = new Date();
date.setTime(date.getTime() - 10000);
document.cookie = "XCWEBLOG_testcookie=yes; expire=" + date.toGMTString();
}
return result;
},
//2017-09-14 pm add cookie
GetCookie: function(c_name) {
if (document.cookie.length > 0) {
var c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
var c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1)
c_end = document.cookie.length
return unescape(document.cookie.substring(c_start, c_end));
}
}
return ""
},
//发送日志
SendLog: function() {
if (XCWEBLOG_ISRUN == "YES_RUN") {
return;
}
if (!this.CookieEnable()) {
XCWEBLOG_ID = XCWEBLOG_IP;
XCWEBLOG_FirstTime = "";
}
//修改其他业务方cookie变化
if(!this.GetCookie('G_CIGDCID')){
this.setBitautoCookie(XCWEBLOG_ID);
}else{
XCWEBLOG_ID = this.GetCookie('G_CIGDCID');
}
this.DCInit();
var url = "//g.yccdn.com/x/x.gif?";
//系统收集信息
for (var N in this.DC) {
if (this.DC[N]) {
url += "&" + N + "=" + this.xcEscape(this.DC[N], this.RE);
}
}
try {
var screen = window.screen.height + ',' + window.screen.width;
url += "&scrn=" + screen;
BrowserDetect.init();
url += "&brw=" + BrowserDetect.browser + BrowserDetect.version + ',' + BrowserDetect.OS;
} catch (e) {}
var xc_id = this.GetCookie('G_CIGDCID')?this.GetCookie('G_CIGDCID'):XCWEBLOG_ID;
url += "&xc_ip=" + XCWEBLOG_IP;
url += "&xc_ft=" + XCWEBLOG_FirstTime;
url += "&xc_id=" + xc_id
//页面自定义变量收集
if (typeof(XCWebLogCollector) != 'undefined') {
for (var N in XCWebLogCollector) {
if (XCWebLogCollector[N]) {
url += "&x." + N + "=" + this.xcEscape(XCWebLogCollector[N], this.RE);
}
}
}
//2017-09-14 pm add cookie
try {
var dcbitautousername = this.GetCookie("username");
if (Bitauto.Login.result.userId) {
url += "&x.Bitauto=userid:" + Bitauto.Login.result.userId + ";";
url += "username:" + Bitauto.Login.result.userName + ";";
}
} catch (err) {}
//浏览器GET请求过长处理
if (url.length > 2048 && navigator.userAgent.indexOf('MSIE') >= 0) {
url = url.substring(0, 2042) + "&sub=1";
}
document.write('
');
try {
//yiche mapping
var urlYiche;
if (document.location.protocol === 'https:') {
urlYiche = "https://adx.yiche.com/cookie/mapping?";
} else {
urlYiche = "https://adx.yiche.com/cookie/mapping?";
}
urlYiche += "sc_id=" + XCWEBLOG_ID;
document.write('
');
//bitauto.com 下写入cookie
if(!this.GetCookie('G_CIGDCID')){
this.setBitautoCookie(XCWEBLOG_ID);
}else{
XCWEBLOG_ID = this.GetCookie('G_CIGDCID');
}
} catch (error) {}
},
//bitauto.com 下写入cookie
setBitautoCookie:function(c) {
var bitDate = new Date();
bitDate.setFullYear(2025);
if (document.domain.indexOf("bitauto.com") != -1 ) {
document.cookie = "CIGDCID="+c+"; expires=" + bitDate.toUTCString()+"; path=/; domain=.bitauto.com";
}
if (document.domain.indexOf("yiche.com") != -1 ) {
document.cookie = "CIGDCID="+c+"; expires=" + bitDate.toUTCString()+"; path=/; domain=.yiche.com";
}
if (document.domain.indexOf("bitauto.com") != -1 ) {
document.cookie = "G_CIGDCID="+c+"; expires=" + bitDate.toUTCString()+"; path=/; domain=.bitauto.com";
}
if (document.domain.indexOf("yiche.com") != -1 ) {
document.cookie = "G_CIGDCID="+c+"; expires=" + bitDate.toUTCString()+"; path=/; domain=.yiche.com";
}
},
SendCustomLog: function(s) {
if (XCWEBLOG_ISRUN == "YES_RUN") {
return;
}
var url = "//" + this.customDomain + "/x.gif?";
//由于跨域,传cookie
if (typeof(XCWEBLOG_ID) != 'undefined') {
url += "c=" + XCWEBLOG_ID + "&d=" + this.dCur;
}
if (typeof(s) != 'undefined') {
for (var N in s) {
if (s[N]) {
url += "&c." + N + "=" + this.xcEscape(s[N], this.RE);
}
}
}
//浏览器GET请求过长处理
if (url.length > 2048 && navigator.userAgent.indexOf('MSIE') >= 0) {
url = url.substring(0, 2042) + "&sub=1";
}
document.write('
');
}
};
XC_LOG.SendLog();