gpt4 book ai didi

javascript - 事件跟踪中的自定义变量,谷歌分析

转载 作者:行者123 更新时间:2023-11-30 09:00:31 25 4
gpt4 key购买 nike

onclick ="_gaq.push(['_setCustomVar', 1, 'Name',document.getElementById('Name').value),3]);"

我在 onclick 事件上使用上面的代码将 Name 的值作为自定义变量传递

但是尝试在 Google Analytic Report 上使用自定义变量过滤器,看起来该值没有作为自定义变量传递并且过滤器返回 0 结果

知道可能出了什么问题吗?

整个senario是这样的

onclick="timeTracker._recordStartTime();"
onclick="timeTracker._recordEndTime();
timeTracker._track(pageTracker, 'Catagory','Action','Name = ' + document.getElementById('Name').value);

_gaq.push(['_setCustomVar', 1, 'Name',document.getElementById('Name').value,3],['_trackPageview']);"

我需要客户变量,因为我需要传递额外的值以进行过滤

最佳答案

在设置自定义变量后添加一个['_trackPageview']

_gaq.push(['_setCustomVar', 1, 'Name','Test',3],['_trackPageview']);

In certain cases this might not be possible, and you will need to set another _trackPageview() request after setting a custom variable. This is typically only necessary in those situations where the user triggers a session- or visit-level custom var, where it is not possible to bundle that method with a pageview, event, or ecommerce tracking call.

来自 Custom Variables in Google docs 上的推荐做法部分.滚动到页面底部。

关于javascript - 事件跟踪中的自定义变量,谷歌分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9687938/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com