跟踪链接点击与谷歌分析? [英] Tracking link clicks with google analytics?

查看:85
本文介绍了跟踪链接点击与谷歌分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Google Analytics的完全初学者,我需要知道如何设置它,以便它可以跟踪我网站上的链接获得的点击次数?



例如,我有一个链接:

 < a href =https://google.com> ; LINK< / A> 

我知道我应该放置一个 onClick 事件在那里,但我不知道它如何链接到谷歌分析?



这是正确的Onclick代码:

  onClick =_ gaq.push(['_ trackEvent','Link','Click','Banner Advert1']); 


解决方案

您可能想要使用事件追踪 - 这是简单的Javascript功能可以从链接上的点击事件触发。您需要确保自己的网页上也有标准Google跟踪脚本



Google事件跟踪指南
$ b


事件追踪是ga.js追踪程式码中的一种方法,您可以使用
记录使用者与网站元素的互动情况,例如
a Flash驱动的菜单系统。这是通过将
方法调用附加到要跟踪的特定UI元素来实现的。如果以这种方式使用
,则会计算此类元素上的所有用户活动,
在Analytics报告界面中显示为事件。
此外,浏览量计算不受使用事件跟踪方法跟踪的用户活动
的影响。最后,事件跟踪
使用了一个可用于收集的面向对象模型,
对与您的网页对象进行不同类型的交互进行了分类。


示例:

 < a href =www.google.comonclick = _gaq.push(['_ trackEvent','Google Link','Action label','Additional info']);> link< / a> 

UPDATE
<上面是API的旧版本 - ga.js.如果您使用的是较新的通用跟踪,请参阅文档。有效地传递的数据与以前相同,但是调用是不同的。



使用较新API的事件跟踪示例:

 < a href =www.google.comonclick =ga('send','event','Google Link','Action label','动作值);>链接< / a> 


I'm a complete beginner with Google Analytics, and I need to know how to set it up so that it can track the number of clicks a link on my website gets?

For example I have a link:

<a href="https://google.com">link</a>

I know I'm supposed to put an onClick event on there somewhere but I don't have any idea how it links to Google Analytics?

Is this the correct Onclick code:

onClick="_gaq.push(['_trackEvent', 'Link', 'Click', 'Banner Advert1']);"

解决方案

You probably want to use event tracking - this is a simple Javascript function to can fire from the click event on your links. You will need to make sure you have the standard google tracking script on your page too.

From Google Event Tracking Guide

Event Tracking is a method available in the ga.js tracking code that you can use to record user interaction with website elements, such as a Flash-driven menu system. This is accomplished by attaching the method call to the particular UI element you want to track. When used this way, all user activity on such elements is calculated and displayed as Events in the Analytics reporting interface. Additionally, pageview calculations are unaffected by user activity tracked using the Event Tracking method. Finally, Event Tracking employs an object-oriented model that you can use to collect and classify different types of interaction with your web page objects.

Example:

<a href="www.google.com" onclick="_gaq.push(['_trackEvent', 'Google Link', 'Action label', 'Additional info']);">link</a>

UPDATE

The above is for the older version of the API - ga.js. If you are using the newer Universal tracking please refer to the docs. Effectively the data passed is the same as before, however the call is different.

Example for event tracking using the newer API:

<a href="www.google.com" onclick="ga('send', 'event', 'Google Link', 'Action label', 'Action Value');">link</a>

这篇关于跟踪链接点击与谷歌分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆