javascript Javascript:Google Analytics Snipper + Google Analytics JS日志记录
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Javascript:Google Analytics Snipper + Google Analytics JS日志记录相关的知识,希望对你有一定的参考价值。
var _gaq = _gaq || [['_setAccount', 'UA-xxxxxxx-1'], ['_trackPageview']];
; (function ($, n, d, t, w, s, undefined) {
//Google Analytics Snipper
var g = d.createElement(t); g.type = 'text/javascript'; g.async = true;
g.src = ('https:' == d.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var b = d.getElementsByTagName(t)[0]; b.parentNode.insertBefore(g, b);
//Javascript Error Logging on Google Analytics
var i = ($) ? $.browser : {}, v = n.appVersion, u = n.userAgent;
if (v.match(/Win/i)) i.os = 'Windows';
else if (v.match(/X11/i)) i.os = 'UNIX';
else if (v.match(/Linux/i)) i.os = 'Linux';
else if (v.match(/Android/i)) i.os = 'Android';
else if (v.match(/Mac/i)) {
i.os = 'MacOS';
if (u.match(/iPhone/i)) i.os = 'iPhone';
else if (u.match(/iPod/i)) i.os = 'iPod';
}
else i.os = 'Unknown OS';
i.screen = s.width + 'x' + s.height;
i.window = w.innerWidth + 'x' + w.innerHeight;
i.appVersion = v;
window.onerror = function (m, f, l) {
var a = f + ':' + l + '\n' + m;
for (var p in i)
a += '\n' + p + ': ' + i[p];
_gaq.push(['_trackEvent', 'error', m, a]);
};
})(jQuery, navigator, document, 'script', window, screen);
以上是关于javascript Javascript:Google Analytics Snipper + Google Analytics JS日志记录的主要内容,如果未能解决你的问题,请参考以下文章
JavaScript JSON
Javascript两个感叹号的用法(!!)
Javascript两个感叹号的用法(!!)
Google Maps Javascript API、DirectionsService、国家列表
Javascript:如何直接从对象生成格式化的易于阅读的 JSON? [复制]
Javascript/Google 地图,自动创建的组合框在第二次迭代中失败