Google Analytics 跟踪 FireFox 扩展程序的使用 [英] Google Analytics to track FireFox extension use

查看:22
本文介绍了Google Analytics 跟踪 FireFox 扩展程序的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Firefox 扩展程序,并希望通过 google 分析跟踪其使用情况,但我无法使其正常工作.

I'm developing a Firefox extension and would like to track its use with google analytics, but I can't get it working.

我尝试从 ga.js 手动调用一个函数,但由于某种原因没有奏效.没有产生错误,但也没有收集任何数据.

I've tried manually calling a function from ga.js, but that didn't work for some reason. No error was produced, but neither was any data collected.

我的最后一次尝试是让网站只包含跟踪 javascript,然后将其加载到 iframe 中的扩展程序中,并配置了 URL,以便它包含有意义的数据.这样,当我使用浏览器访问上述网页时,分析就会连接起来,但不是在扩展程序中.我已经尝试在网站上放置一些可见的 javascript 并确认该网站的 javascript 正在执行.这种方法也适用于其他跟踪器,但我不喜欢它们的输出,更喜欢 Google Analytics.

My last attempt was to have a website that just holds the tracking javascript and then load it within the extension in an iframe with the URL configured so it contains meaningful data. This way the analytics are getting connected when I visit said webpage with a browser, but not in an extension. I've tried putting some visible javascript on the site and have confirmed the site's javascript is executing. This method also works with other trackers, but I don't like their output and would prefer Google Analytics.

有什么想法可以尝试完成此任务吗?

Any ideas what else I could try to accomplish this?

推荐答案

解决方案是使用 Remy Sharp 的迷你库,用于使用 Google Analytics 跟踪书签和扩展程序.很有魅力.

The solution is to use Remy Sharp's mini library for tracking bookmarklets and extensions with Google Analytics. Works like a charm.

用法很简单:

gaTrack('UA-123456', 'yoursite.com', '/js/script.js');

请注意,由于它不使用 cookie,因此浏览量和访问量之间没有区别,或者就此而言,访问量和访问者之间没有区别.但是,其余功能相当可靠.

Note that, since it doesn't use cookies, there's no differentiation between pageviews and visits, or for that matter, between visits and visitors. But, the rest of the functionality is fairly reliable.

这篇关于Google Analytics 跟踪 FireFox 扩展程序的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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