如何使用 Google Analytics 和 utm.gif 跟踪自定义参数
情况 我想使用 GA 来跟踪一些服务器端操作。这就是为什么我无法使用 GA JavaScript 函数。但是,您可能知道,您可以直接从服务器请求 utm.gif。这已经很好用了。
问题 我想跟踪自定义参数。但我不知道如何将它们以正确的格式添加到 url-request
这应该执行自定义参数。但我在GA中没有得到任何结果。
utme=5(Init*load_success*http://www.mydomain.de)8(userstatus)9(fan)11(2)
参数的完整列表:
ref ts
utmac UA-XXXXXX-5
utmcc __utma=186215409.1789216404.1265552708.1280074861.1280493144.21;+__utmz=;
utmcs ISO-8859-1
utmdt Button
utme 5(Init*load_success*http://www.mydomain.de)8(mycustomvar)9(mycustomvalue)11(2)
utmfl -
utmhn mydomain.de
utmje -
utmn 1114675642
utmp button
utmr http://www.mydomain.de
utmsc -
utmsr -
utmul de-de
utmwv 4.5.7
The situation
I'd like to use GA to track some serverside operations. That's why I cant make use of the GA JavaScript functions. But, as you might know, you can request the utm.gif right from your server. This already works fine.
The Problem
I'd like to trackt custom parameters. But I have no idea how to add them in the right format to the url-request
This one should do the custom parms. But I didn't get any results in GA.
utme=5(Init*load_success*http://www.mydomain.de)8(userstatus)9(fan)11(2)
Full list of params:
ref ts
utmac UA-XXXXXX-5
utmcc __utma=186215409.1789216404.1265552708.1280074861.1280493144.21;+__utmz=;
utmcs ISO-8859-1
utmdt Button
utme 5(Init*load_success*http://www.mydomain.de)8(mycustomvar)9(mycustomvalue)11(2)
utmfl -
utmhn mydomain.de
utmje -
utmn 1114675642
utmp button
utmr http://www.mydomain.de
utmsc -
utmsr -
utmul de-de
utmwv 4.5.7
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
考虑到您发布的内容,不确定出了什么问题,但是您是否可以以传统方式(使用 JavaScript)写出您想要发送的内容并将其放在测试页面上。使用 firebug 或其他工具来获取所构建的请求 url,并将其与您现在拥有的进行比较。
not sure what's going wrong, given what you posted, but how about you write out what you want to send the traditional way (with javascript) and put it on a test page. Use firebug or whatever to grab the requested url that's built and compare it to what you have now.
utme gif 请求参数的值是由 ga.js编码的——据我所知,这是唯一的一个。
调用__trackEvent是设置utme值的常用方法。不过,这些是客户端事件,这无疑是您尝试直接设置 utme 的原因。
因此,如果您只想绑定5(Initload_successhttp://www.mydomain.de)8(userstatus)9(fan)11(2) 到变量 utme,并且你不能依赖 user-触发该绑定的行为,那么我的建议是:
将数据打包到页面范围内的“自定义变量” - 这样,当调用 __trackPageview() 时,将设置该值。
以下是 HTML 中实现该功能所需的分析代码:
自定义变量的方法签名:
在 HTML 中(当然是顺序问题):
这里的关键点是参数“值”可以动态设置,因此对于'value'参数,我猜你想传入5(Initload_successhttp://www.mydomain.de)8(userstatus)9(fan)11(2)
最后,这是两个关键来源( 实施指南,使用指南)来自 GA 团队的自定义变量
The value of the utme gif Request parameter is encoded by ga.js--it's the only one that is, as far as i know.
Calling __trackEvent is the usual way to set the value of utme. These are client-side events though, which is no doubt why you are trying to set utme directly.
So if you just want to bind 5(Initload_successhttp://www.mydomain.de)8(userstatus)9(fan)11(2) to the variable utme, and you can't rely on user-behavior to trigger that binding, then here's what i suggest:
Pack your data into a 'custom variable' scoped to the page--this way, when the __trackPageview() is called, the value will be set.
Here's the analytics code required in your HTML to implement that:
The method signature for a custom variable:
Within the HTML (order matter, of course):
A key point here is that the parameter 'value' can be set dynamically, so for the 'value' parameter, i guess you want to pass in 5(Initload_successhttp://www.mydomain.de)8(userstatus)9(fan)11(2)
Finally, here are the two key sources (Implementation Guide, Usage Guide) on Custom Variables from the GA Team