Ole*_*lev 2 javascript google-analytics
这是Google Analytics的代码
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20366831-2']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
Run Code Online (Sandbox Code Playgroud)
我的客户端如何调用Google匿名函数?
这是因为匿名函数以.结尾 ()
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})(); // <--- The () calls the anonymous code
Run Code Online (Sandbox Code Playgroud)
正如您将看到的,此代码基本上将一个script标记注入到DOM中,该标记由浏览器运行.
| 归档时间: |
|
| 查看次数: |
1089 次 |
| 最近记录: |