7is7.com > Software > Firefox > Download Counter
Firefox Head
Search Mozilla and Firefox related sites with Foxysearch.org.

Create a Firefox 4 Download Counter

Version 0.3.1

2011-07-05: Disabled. No count of Firefox 5 downloads has been made available by Mozilla.

Explains how to add a near real-time running Firefox 4 download counter to your website or blog.

Sample Download Counters:

Update total per download: millions
Update total per second: millions
Update total once (at page load): millions
Full Screen Demo: Party Counter

Install Your Own:

This page explains how to add a near real-time running Firefox download counter to your webpage. There are two ways to do it:

1 Installation (Remotely Hosted - Recommended)

The easiest way to install a download counter on your site is to use the remotely hosted version. For that, you only need to copy and paste the following code into your webpage, there where you want the Firefox download counter to appear:

Proceed with section 3 to further tweak your download counter to your needs.

2 Installation (Self Hosted)

For a self hosted implementation, you need to download the tar file that contains the following two programs:

Both these programs are free to use, modify and/or redistribute under the terms of the GNU GPL 3 license. The Perl program, which has to run on your server, has been developed and tested on Linux, the JavaScript code will run in the browsers of your visitors and should run everywhere, it has been tested on many different systems.

You need to edit the fxcounter.pl script and set the variable $fxcounter (under SETTINGS) to reflect the path of the file on your server. The path must be identical to the one where you have placed fxcounter_lib.js as that file will be trying to load fxcounter.js from the directory it is located in itself. This is the line to edit:

my $fxcounter="$ENV{'HOME'}/www/html/software/firefox/fxcounter.js";

fxcounter.pl should then be executed at regular intervals, for example via the crontab every 10 minutes.

Finally the following code should be placed in the webpage where you want the download counter to appear. (Assuming fxcounter_lib.js is placed in the same directory as your webpage, otherwise you need to specify the path (or URL) for fxcounter_lib.js):

Then proceed to section 3 of this page to find out how to tweak your download counter to your needs.

Notice: Due to changing sources of download counts, self-hosted versions may cease to function when those sources change.

3 Tweaking Details

You can tweak many details of the code, to suit your particular needs. We take a look at some of the lines of the code you copied.

Update Frequency

Original line:

By default the download counter updates itself for every estimated download. You can change the update frequency of the download counter, by indicating the number of milliseconds between updates of the total:

or

You can also name the download counter element differently (default ID is "fxctotal") but you'll need to start it with that ID as the first argument for fxcStart. You can have several counters on one page as long as each has a unique ID and each counter is "started" with their own fxcStart. Each counter can have its own update frequency.

Appearance (Style)

Original line:

This line defines the style of the download counter. You may change the style or remove the line entirely and style the download counter by other means.

Thousand Separator

Original line:

You can change the thousand separator to your local settings, for example in most of Europe the thousands separator is a dot:

or

Initial Value and Link

Original line:

This line of the code indicates where the download counter will appear. It has an initial value set to "millions", you can replace that with anything you want, though visitors are unlikely to see it, unless the counter does not start (e.g. JavaScript is turned off).

You can also give the element a different ID (by default it's fxctotal), but be sure to start fxcStart by with your chosen ID.

And finally you can remove the link to the full screen download counter, by replacing this line with the following line:

Tip: If the total and words around it seem to move slightly from right to left and back set the font-family to a monospace font (or just 'monospace').

4 Final Notes

Notice:

The total downloads shown are an estimate (mouse over the totals to see the information on which it is based). The older the source data the less accurate the total will be. The script does check for new data regularly. We also never know for sure if the last published total is accurate as Mozilla updates the timestamp even when the count doesn't update. We discard timestamp only updates, but there is still uncertainty about the actual download rate. We minimize the impact of this problem by using a sliding average.

Related resources:

Feedback:

The software for the download counter was developed by Otto de Voogd. For feedback and bug reports please contact Otto de Voogd by E-mail.

Get Firefox! Download LibreOffice Use Fedora