简体   繁体   English

如何让Google Analytics跟踪幻灯片中的各个图像?

[英]How do I get Google Analytics to track individual images on a slideshow?

I have a jQuery slideshow, I'm using the cycle plugin. 我有一个jQuery幻灯片,我正在使用循环插件。 I'm decent with jQuery, but I don't know how I should tie it in with Google Analytics to show me how many times each image is requested. 我对jQuery不太满意,但我不知道如何将其与Google Analytics结合使用,以向我显示每个图像的请求次数。

I've looked around online but I haven't been able to find any good documentation for it. 我在网上看过,但我找不到任何好的文档。

Can someone give me a simple example and maybe a link to the documentation supporting the example? 有人可以给我一个简单的例子,也许是支持这个例子的文档的链接?

Thanks! 谢谢!

Edit: 编辑:

The key is just to use this code to send an event: 关键是使用此代码发送事件:

_gaq.push(['_trackEvent', 'PageLocation', location.href]);

But you need to have the asyncronous syntax of calling Google Analytics, which will probably look something like this: 但是您需要具有调用Google Analytics的异步语法,这可能看起来像这样:

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxx-1']);
  _gaq.push(['_setDomainName', 'site.com']);
  _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';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

BTW you might need to wait for the document to be ready / loaded before executing the _gaq.push line :) 顺便说一下,你可能需要等待文件准备好/加载才能执行_gaq.push行:)

I'm not sure why you would want to do this. 我不确定你为什么要这样做。 Analytics is about the page in relation to how the users interact with it. Analytics是关于用户如何与之交互的页面。

If you had a random image being shown first on a page it could be useful to know which one is causing the biggest bouncerate, or if your images in the slideshow were hyperlinked and you wanted to know which one is gathering the most click-through to other pages, but the ammount of times an image is loaded is a pretty arbitrary statistic. 如果您首先在页面上显示随机图像,那么知道哪个图像导致最大的弹跳量,或者幻灯片中的图像是否已超链接并且您想知道哪个图像收集的点击次数最多其他页面,但加载图像的次数是一个非常随意的统计数据。

Event tracking is probably what you should be looking at, but im unsure of what you are trying to do with the tracking data... if you give a better explanation id be more then happy to help. 事件跟踪可能就是您应该关注的内容,但我不确定您要对跟踪数据做些什么...如果您提供更好的解释,则更愿意提供帮助。

http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html

...... ......

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

相关问题 如何在Google Analytics(分析)中跟踪Google可视化图表事件? - How do I track Google visualization chart events in Google analytics? 如何根据提交的表单在Google Analytics(分析)中跟踪转化? - How do I track a conversion in Google Analytics Based on Form Submission? 如何在Google Analytics(分析)中跟踪Fancybox点击? - How do I track Fancybox clicks in Google Analytics? 如何配置Google Analytics(分析)以将URL参数作为单个页面进行跟踪 - How to configure Google Analytics to track URL parameters as individual pages 如何让谷歌分析响应“不跟踪” - How to make Google Analytics respond to “Do Not Track” 如何使用Google Analytics(分析)或Yahoo Web Analytics跟踪对Facebook页面的访问? - How do I track visits to facebook pages using Google Analytics or Yahoo Web Analytics? 如何停止图像的幻灯片放映? - How do I stop slideshow of Images? 如何在Javascript幻灯片中链接单个图像? - How to link individual images in Javascript Slideshow? 如何使用Google Analytics(分析)跟踪A / B测试中的社交参与度? - How do I track social engagement in an A/B testing using Google Analytics? 如何使用Google Analytics维度在多个表单页面中跟踪用户ID? - How do I track userID across multiple form pages using Google Analytics Dimensions?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM