/** * 视频站日志记录行为js * Created by cleargui on 2016/8/19 */ var global_qid = 'null', global_uid = 'null', global_soft_type = 'null', global_soft_name = 'null', global_wayPath = 'null', global_from = 'null', global_os = 'null', global_browser = 'null', global_pixel = 'null', //客户端分辨率 global_ime = 'null', //App用户的ime号 global_idx = 0, global_fr_url = 'null', ver = 'null', appqid = 'null', ttloginid = 'null', apptypeid = 'null', appver = 'null', adsource = 'null', idx = 'null', btype = 'null', subtype = 'null', to = 'null', playingTime = 'null', currentTime = 'null', action = 'null', ishot = 'null', global_vbb = 'null'; (function() { // 获取uid,存入cookie var recommendtype = '-1'; //是否是推荐新闻默认-1 var getData_url = '//videopclog.dftoutiao.com/videopclog/vactive'; //请求传递数据接口 var operation_url = '//videopclog.dftoutiao.com/videopclog/voperation'; //视频操作日志接口 //var operation_url = '//123.59.60.170/videopclog/voperation'; //视频操作日志接口 var soft_type = 'toutiao_video_pc'; global_soft_type = soft_type; var soft_name = 'DFTT_VIDEO_PC'; global_soft_name = soft_name; var OSType = detectOS(); global_os = OSType; var browserType = explorerType(); global_browser = browserType; var _vbb = '0.5.1'; //版本号 global_vbb = _vbb; var wayPath = String(coo_name) || 'null'; //渠道来源 var from = ''; //来源(备选参数) var ishot = ''; //是否热新闻 to = "http://" + window.location.host + window.location.pathname; //当前url var fr_url = document.referrer; //来源 playingTime = '' || 'null'; //实际观看时长 currentTime = '' || 'null'; //当前播放位置 action = '' || 'null'; //操作类型 function Mycookie(uid) { //设置cookie var info = '{"uid":"' + uid + '","softtype":"' + soft_type + '","softname":"' + soft_name + '"}'; $.cookie('mylist', info, { expires: 3000, path: '/', domain: 'eastday.com' }); } if(!$.cookie('mylist')) { user_uid = getUserId(); Mycookie(user_uid); } else { user_uid = $.parseJSON($.cookie('mylist')).uid; } global_qid = wayPath; global_wayPath = wayPath; if(typeof(newstype) == "undefined" || newstype == '') newstype = 'null'; if(typeof(typename) == "undefined" || typename == '') typename = 'null'; //判断浏览器 function explorerType() { var brow = $.browser; var bInfo = "非主流浏览器"; if(brow.msie) { bInfo = "MicrosoftInternetExplorer" + brow.version; } if(brow.mozilla) { bInfo = "MozillaFirefox" + brow.version; } if(brow.safari) { bInfo = "AppleSafari" + brow.version; } if(brow.opera) { bInfo = "Opera" + brow.version; } if(brow.chrome) { bInfo = "chrome" + brow.version; } return bInfo; } function getUserId() { return(+new Date()) + Math.random().toString(10).substring(2, 6); } //获取客户端操作系统类型 function detectOS() { var sUserAgent = navigator.userAgent; var isWin = (navigator.platform === "Win32") || (navigator.platform === "Windows"); var isMac = (navigator.platform === "Mac68K") || (navigator.platform === "MacPPC") || (navigator.platform === "Macintosh") || (navigator.platform === "MacIntel"); var bIsIpad = sUserAgent.match(/ipad/i) === "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) === "iphone os"; var isUnix = (navigator.platform === "X11") && !isWin && !isMac; var isLinux = (String(navigator.platform).indexOf("Linux") > -1); var bIsAndroid = sUserAgent.toLowerCase().match(/android/i) === "android"; var bIsCE = sUserAgent.match(/windows ce/i) === "windows ce"; var bIsWM = sUserAgent.match(/windows mobile/i) === "windows mobile"; if(isMac) return "Mac"; if(isUnix) return "Unix"; if(isLinux) { if(bIsAndroid) { return "Android"; } else { return "Linux"; } } if(bIsCE || bIsWM) { return 'wm'; } if(isWin) { var isWin2K = sUserAgent.indexOf("Windows NT 5.0") > -1 || sUserAgent.indexOf("Windows 2000") > -1; if(isWin2K) return "Win2000"; var isWinXP = sUserAgent.indexOf("Windows NT 5.1") > -1 || sUserAgent.indexOf("Windows XP") > -1; if(isWinXP) return "WinXP"; var isWin2003 = sUserAgent.indexOf("Windows NT 5.2") > -1 || sUserAgent.indexOf("Windows 2003") > -1; if(isWin2003) return "Win2003"; var isWinVista = sUserAgent.indexOf("Windows NT 6.0") > -1 || sUserAgent.indexOf("Windows Vista") > -1; if(isWinVista) return "WinVista"; var isWin7 = sUserAgent.indexOf("Windows NT 6.1") > -1 || sUserAgent.indexOf("Windows 7") > -1; if(isWin7) return "Win7"; var isWin8 = sUserAgent.indexOf("Windows NT 6.2") > -1 || sUserAgent.indexOf("Windows 8") > -1; if(isWin8) return "Win8"; } return "other"; } /*截取url参数*/ function GetRequest(temp) { var theRequest = new Object(); // if (url.indexOf("?") != -1) { var str = temp.substr(1); var strs = str.split("&"); for(var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]); } // } return theRequest; } })();