使用Google Analytics进行自定义跟踪 [英] Custom Tracking with Google Analytics
问题描述
我想弄清楚如何使用我的谷歌分析帐户,并对某些链接等进行自定义跟踪,但是在Google上的帮助网站上的技术信息并没有让我获得任何地方的帮助。有没有人做过这样的事情?指向正确的方向。
更新
这是代码,我没有在我的分析帐户中看到结果,但我没有收到错误
在标题中:
< script type =文本/ JavaScript的>
var _gaq = _gaq || [];
_gaq.push(['_ setAccount','UA-XXXXXXXX']); //注释发布
_gaq.push(['_ trackPageview']);
(function(){
var ga = document.createElement('script'); ga.type ='text / javascript'; ga.async = true;
ga .src =('https:'== document.location.protocol?'https:// ssl':'http:// www')+'.google-analytics.com / ga.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0])。appendChild(ga);
})();
< / script>
加上我的链接的href,我把这个:
onclick =_ gaq.push(['_ trackEvent','Link Sponsored','Clicked Sponsored']);
这是通过asyc ga代码实现的正确方法吗?
几件事:
p>-
是否启用 事件跟踪?这必须在您的配置文件中设置。
使用例如Firefox附加组件 Live HTTP Headers ,查找对_utm.gif的请求。要做到这一点: -
打开LiveHTTP标题面板;
- 然后选择使用正则表达式过滤网址;
have you enabled "Event Tracking"? This must be set in your "Profile"
While watching HTTP header activity using, for instance, the Firefox add-on "Live HTTP Headers", look for requests to the _utm.gif. To do this:
open the LiveHTTP Headers Panel;
then select the "Config" tab;
then check "Filter URLs with regexp;
type _utm.gif in the text box next to the box you just chekecked; and
select the "Generator" tab to record the activity.
li>
在接下来的
文本框中输入 _utm.gif ,然后输入您刚刚使用的框; >选择生成器选项卡以记录
的活动。 b $ b
I am trying to figure out how to use my google analytics account, and do custom tracking on certain links and such, but following the technical information on the help site on google isn't getting me anywhere. Has anyone done something like this? Point me in the right direction.
UPDATE This is the code, I am not seeing the results in my analytics account yet, but I am not getting errors now.
In header:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX']); //Commented Out for posting
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script>
THen on the href of my link I put this:
onclick="_gaq.push(['_trackEvent', 'Link Sponsored', 'Clicked Sponsored']);"
Is this the Correct Way to do it via asyc ga code?
I can't find the problem from your code.
A couple of things:
这篇关于使用Google Analytics进行自定义跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!