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

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

问题描述

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

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?

例如我有一个链接:

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

我知道我应该在某处放置一个 onClick 事件,但我不知道它如何链接到 Google Analytics?

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?

这是正确的 Onclick 代码:

Is this the correct Onclick code:

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

推荐答案

您可能想要使用事件跟踪 - 这是一个简单的 Javascript 函数,可以从链接上的点击事件中触发.您还需要确保您的网页上也有标准谷歌跟踪脚本.

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.

来自 Google 事件跟踪指南

事件跟踪是 ga.js 跟踪代码中提供的一种方法您可以用来记录用户与网站元素的交互,例如Flash 驱动的菜单系统.这是通过附加对要跟​​踪的特定 UI 元素的方法调用.使用时这样,所有用户在这些元素上的活动都会被计算出来,并且在 Analytics 报告界面中显示为事件.此外,浏览量计算不受用户活动的影响使用事件跟踪方法进行跟踪.最后,事件跟踪使用面向对象的模型,您可以使用它来收集和对与网页对象的不同类型的交互进行分类.

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.

示例:

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

更新

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

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.

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

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天全站免登陆