javascript - 如何创建自己的类似于谷歌分析的 javascript api

标签 javascript api google-analytics-api

<分区>

我只想知道 google analytics 的工作原理以及这段代码的含义?

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'some value']);
_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);
})();

提前谢谢你..

最佳答案

这是一个相当广泛的问题,但您可以在这里找到一些有用的信息 https://developers.google.com/analytics/resources/concepts/gaConceptsTrackingOverview

它显示给你what the code actually does以及describing all of the parameters .

关于javascript - 如何创建自己的类似于谷歌分析的 javascript api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27822828/

相关文章:

javascript - 如何测试关联数组中的所有值是否都为 true? (Javascript)

javascript - 显示范围或htmlfrag的html内容

javascript - 成帧器运动,在 x 动画时延迟旋转 Y

javascript - 从前端向 API 服务器发送密码的最佳做法是什么?

ios - swift 5 : Display Data Retrieved in Closure to Table View

php - curl -F 是什么意思? PHP Instagram

google-analytics - Google Analytics Management API - 如何将用户添加到个人资料

google-analytics - 如何在 Google Analytics 中按访问者报告自定义事件

javascript - 单击时不会触发绑定(bind)了 jQuery 单击事件的 Div?

java - 使用 Google Analytics API v4 获取数据