Google Analytics _trackEvent - 始终是网站的根目录
我正在尝试用 Google Analytics 做一些非常奇怪的事情,我会尽力解释。
我有一个控股网站,它通过 jQuery 加载表单,主网站有自己的跟踪代码,并且 ajax 使用不同的跟踪代码加载内容,这工作得很好。
_gat._createTracker('UA-XXXXXXXX-2', 'myTracker');
var _gaq = _gaq || [];
_gaq.push(['myTracker._setAccount', 'UA-XXXXXXXX-2']);
该表单分为多个部分,当每个部分完成时,我都会推送带有自定义页面 url 的页面跟踪事件,这似乎又工作得很好。
_gaq.push(['myTracker._trackPageview', '/form/stage1/']);
但我想做的是跟踪表单中更改的事件(下拉列表更改等...),这有点工作,事件在 Google Analytics 界面中可见,但在页面选项卡中,它们都显示在“ /”不是我想要的“/form/stage1/”(我认为“/”来自它所在的主站点。
_gaq.push(['myTracker._trackEvent', 'Sample', ddValue]);
所以我要问的是有没有办法告诉 _trackEvent 跟踪不同的页面网址?
提前致谢。
I am trying to do some quite strange stuff with Google Analytics, I will try and explain as best as possible.
I have a holding site, that loads a form in via jQuery, the main site has its own tracking code, and the ajax loaded content using a different tracking code, this works fine.
_gat._createTracker('UA-XXXXXXXX-2', 'myTracker');
var _gaq = _gaq || [];
_gaq.push(['myTracker._setAccount', 'UA-XXXXXXXX-2']);
The form is broken up into multiple parts and I push a page track event with a custom page url through as each part is completed, again this seems to work fine.
_gaq.push(['myTracker._trackPageview', '/form/stage1/']);
But what I want to do is track events for changes in the form (dropdown changes, etc...), this is kinda working, the events as visible in the Google Analytics interface, but in the pages tab, they all appear under "/" not "/form/stage1/" as I would like (I think that the "/" is coming from the main site which it is sat in.
_gaq.push(['myTracker._trackEvent', 'Sample', ddValue]);
So what I am asking is there any way to tell _trackEvent to track against a different page url?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有;
_trackEvent
使用location.pathname+location.search
,无论最近的_trackPageview
调用作为其自定义值传递的是什么。但是,您只能使用事件的“类别”和“操作”字段;您仍然拥有可以传递该值的“标签”。
There is not;
_trackEvent
useslocation.pathname+location.search
, regardless of what the most recent_trackPageview
call passed as its custom value.However, you're only use the "Category" and "Action" fields of the Event; you still have the "Label" to which you can pass that value in.