Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics to track FireFox extension use

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

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.

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?

like image 287
Swizec Teller Avatar asked Nov 20 '09 13:11

Swizec Teller


People also ask

Can I use Google Analytics on Firefox?

You can download Safari at http://www.apple.com/safari/download. In general, Analytics supports the two most-recent major releases of Chrome, Firefox, Edge, and Safari (on a rolling basis). We highly recommend that you use one of these supported browsers.

Can Google Analytics track type of browser?

Google Analytics can be a quick and free way to measure screen resolutions, devices, and the browsers your site's visitors are often using.

Can you use Google Analytics in Chrome extension?

Analytics users can download it from the Chrome web store. After you install the extension for your Chrome browser, you can load a page that you are tracking with Analytics and see the following information: Metrics: Pageviews, Unique Pageviews, Avg. Time on Page, Bounce Rate, % Exit.


1 Answers

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

Usage is as simple as:

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

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.

like image 160
Yahel Avatar answered Sep 18 '22 05:09

Yahel