Google Analytics跟踪脚本备注/审核

时间:2016-12-12 07:12:56

标签: javascript google-analytics

当您想要使用Google Analytics时,我正在查看Google为您提供的脚本。

如果你看看IIF,你会发现它需要7个参数,但只传递了5个参数。

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'trackingid', 'auto');
ga('send', 'pageview');

他们制作了一个很好的论证等值图,这在Javascript中不会中断,但不是' a'和' m'论证已经过时了?

我想是' 1 *新日期()'也是一个不好的做法,getTime会更好。但他们可能会为浏览器支持这样做。虽然getTime受到广泛支持。

0 个答案:

没有答案