不知道老外童鞋是怎么想的,不过这样确实可以提醒copy代码的人是否误把他人统计进行使用.. 其实把判断中的内容修改为添加脚本元素可以主动避免这种事情的发生..
window.onload = function() {
var host = window.location.host;
if(host != "yourdomain.com" && host != "www.yourdomain.com" && host != "translate.googleusercontent.com" && host != "subbane.yourdomain.com")
{
alert("Hey, it looks like you may have accidentally copied my analytics code (perhaps from a demo of mine?). Could you please remove it? Thanks a bunch! - Neal Grosskopf");
}
};