Google Analytics
Google Analytics
Google Analytics is one of the most popular digital analytics software. It is Google's free web analytics service that allows you to analyze in-depth detail about the visitors on your website. It provides valuable insights that can help you to shape the success strategy of your business.
Google Analytics for Beginners
How analytics.js Works
Almost everything you need to measure with analytics.js can be done using the ga()
command queue. This guide explains what the command queue is, how it works, and how to execute commands to measure user interactions.
Adding commands to the queue
All calls to the ga()
command queue share a common signature. The first parameter, the "command", is a string that identifies a particular analytics.js method. Any additional parameters are the arguments that get passed to that method.
The method a particular command refers to can be a global method, like create
, a method on the ga
object, or it can be an instance method on a tracker object, like send
. If the ga()
command queue receives a command it doesn't recognize, it simply ignores it, making calls to the ga()
function very safe, as they will almost never result in an error.
For a comprehensive list of all commands that can be executed via the command queue, see the ga()
command queue reference.
ga.create
Creates a new tracker instance with the specified fields.
ga.create([trackingId], [cookieDomain], [name], [fieldsObject]);
Note: it's recommended to call the create
method via the ga
command queue. See the create method reference for more details.
https://developers.google.com/analytics/devguides/collection/analyticsjs/ga-object-methods-reference#create
https://developers.google.com/analytics/devguides/collection/analyticsjs/command-queue-reference#create
send
Sends a hit to Google Analytics.
Usage
ga('[trackerName.]send', [hitType], [...fields], [fieldsObject]);
The fields that are sent are the values specified in the ...fields
parameters and fieldsObject
, merged with the fields currently stored on the tracker.
Note: the values specified in ...fields
and fieldsObject
are sent with the current hit, but they are not stored on the tracker object. Use the set method to update a tracker.
<script> (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', '@System.Configuration.ConfigurationManager.AppSettings["GoogleAnalyticsID"]', 'auto'); ga('send', 'pageview'); </script>
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2015-04-07 C#的运算符重载
2015-04-07 dotfuscator初步