Javascript gaJs主机

标签 javascript

我只想知道这个脚本的用途..

 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

我在一些网站上发现了这个.. :)

还有这个..

 var pageTracker = _gat._getTracker("UA-1965499-1");

 pageTracker._initData();

 pageTracker._trackPageview();

最佳答案

它的 Google Analytics跟踪器代码。

引自此链接:http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55591

Google Analytics shows you how people found your site, how they explored it, and how you can enhance their visitor experience. With this information, you can improve your website return on investment, increase conversions, and make more money on the web. This guide can help you familiarize yourself with the main features of Google Analytics.

现在,此页面建议使用您提到的代码: http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55488

虽然,这是旧的(传统的)方法。 Google 引入了用于添加跟踪器代码的新异步方法。

关于Javascript gaJs主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5055048/

相关文章:

javascript - JS 重构多个条件并返回 bool 值

javascript - 如何处理 Relay Modern 上的突变错误?

javascript - 将普通数组转换为html中的对象数组

javascript - 如何在动态更新的图表上更新 highstock 指标

jquery - Javascript 网格 UI - 可拖动且可调整大小

javascript - 数据表行中的固定字符

javascript - 如何通过ajax发送文件)而不使用html表单?

javascript - 在下拉过渡中包含 CSS 三 Angular 形

javascript - 通过javascript点击获取 'for'值

javascript - 如何使用 node.js 为文本文件的每一行创建一个数组条目