简体   繁体   English

Google Analytics _trackEvent-始终是网站的根目录

[英]Google Analytics _trackEvent - always root of site

I am trying to do some quite strange stuff with Google Analytics, I will try and explain as best as possible. 我正在尝试使用Google Analytics(分析)做一些非常奇怪的事情,我将尝试并尽可能最好地进行解释。

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. 我有一个保存站点,该站点通过jQuery加载表单,主站点具有自己的跟踪代码,而ajax使用不同的跟踪代码加载了内容,效果很好。

_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. 表单分为多个部分,当每个部分完成时,我通过自定义页面URL推送页面跟踪事件,这似乎也可以正常工作。

_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. 但是,我想做的是跟踪表单中的更改事件(下拉列表更改等),这很正常,这些事件在Google Analytics(分析)界面中可见,但是在页面标签中,它们都显示在“ /”不是我想要的“ / form / stage1 /”(我认为“ /”来自它所在的主站点。

_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? 因此,我要问的是,有什么方法可以告诉_trackEvent跟踪不同的页面网址吗?

Thanks in advance. 提前致谢。

There is not; 那没有; _trackEvent uses location.pathname+location.search , regardless of what the most recent _trackPageview call passed as its custom value. _trackEvent使用location.pathname+location.search ,而不管最新的_trackPageview调用作为其自定义值传递了什么。

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. 您仍然可以将其值传递给“标签”。

_gaq.push(['myTracker._trackEvent', 'Sample', ddValue, "/form/stage/1"]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM