如何使用 Google Analytics 和 utm.gif 跟踪自定义参数

发布于 2024-09-12 03:30:56 字数 828 浏览 8 评论 0原文

情况 我想使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉城メ夜风 2024-09-19 03:30:56

考虑到您发布的内容,不确定出了什么问题,但是您是否可以以传统方式(使用 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.

枯寂 2024-09-19 03:30:56

utme gif 请求参数的值是由 ga.js编码的——据我所知,这是唯一的一个。

调用__trackEvent是设置utme值的常用方法。不过,这些是客户端事件,这无疑是您尝试直接设置 utme 的原因。

因此,如果您只想绑定5(Initload_successhttp://www.mydomain.de)8(userstatus)9(fan)11(2) 到变量 utme,并且你不能依赖 user-触发该绑定的行为,那么我的建议是:

将数据打包到页面范围内的“自定义变量” - 这样,当调用 __trackPageview() 时,将设置该值。

以下是 HTML 中实现该功能所需的分析代码:

自定义变量的方法签名:

pageTracker._setCustomVar(slot,    // integer between 1 and 5, inclusive (just use '1')
                          name,    // user-defined name for the custom variable
                          value,   // string representing the value for the custom variable
                          scope,   // you want '3' for page-level (an int, not a string though)  
);

在 HTML 中(当然是顺序问题):

pageTracker.__setCustomvar(1, "A Name", "A Value", 3);
pageTracker.__trackPageview();

这里的关键点是参数“值”可以动态设置,因此对于'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:

pageTracker._setCustomVar(slot,    // integer between 1 and 5, inclusive (just use '1')
                          name,    // user-defined name for the custom variable
                          value,   // string representing the value for the custom variable
                          scope,   // you want '3' for page-level (an int, not a string though)  
);

Within the HTML (order matter, of course):

pageTracker.__setCustomvar(1, "A Name", "A Value", 3);
pageTracker.__trackPageview();

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文