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

问题描述

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



例如,我有一个链接:

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

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



这是正确的Onclick代码:

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


解决方案

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




$ b

示例:

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

UPDATE
通用跟踪,请参阅。有效地传递的数据与以前相同,但是调用是不同的。



使用较新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

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>

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

08-26 15:13
查看更多