Closed Bug 391347 Opened 17 years ago Closed 17 years ago

Enable per locale tracking of the download links

Categories

(www.mozilla.org :: General, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stas, Assigned: stas)

References

Details

Attachments

(1 file, 6 obsolete files)

Attached file installTrackers() (obsolete) —
The download links at mozilla.com point to (for example):
http://www.mozilla.com/products/download.html?product=firefox-2.0.0.6&os=win&lang=pl
which redirects to:
http://www.mozilla.com/en-US/products/download.html?product=firefox-2.0.0.6&os=win&lang=pl

However, in Urchin we only find the following record:
/en-US/products/download.html?product=firefox-2.0.0.6

There is no locale information so we can't actually break the statistics down into per locale download data. I'm not sure why Urchin doesn't register the download parameters that follow "product". It seems that it ignores the URL part which starts with the first "&", but I've seen on mozilla-europe.org that it can convert it into "%3D".

On mozilla-europe.org site we don't have the "thank you for downloading firefox" page (which is tracked by Urchin), so Pascal Chevrel and me, we wrote a little piece of JavaScript, which puts onclick events pointing to urchinTracker() function on each download link. This way, we are able to track clicks on these link, as they get registered as normal pages (e.g. /download-tracking/pl/firefox-2.0.0.6/osx).

I attach the script to this bug. Maybe we could use it on mozilla.com pages? 

Advantages:
- get per locale download statistics easily, with Urchin
- observe click paths for each locale
- measure the downloads from release notes pages
- measure the downloads from http://www.mozilla.com/en-US/firefox/all.html
Attachment #275761 - Attachment mime type: application/x-javascript → text/plain
Comment on attachment 275761 [details]
installTrackers()

-		for (var i = 0; link = document.links[i]; i++) {
+		for (var i = 0; link = document.getElementsByTagName('a')[i]; i++) {

or

+		for (var link in document.getElementsByTagName('a')) {

-			downloadLinks[i]['param' + parameterDetails[0].charAt(0).toUpperCase() + parameterDetails[0].substring(1)] = parameterDetails[1]

why this? downloadLinks[i].mozParams = Array();
downloadLinks[i].mozParams['name1'] etc. sounds cleaner cause you can easly iterate through it, am I wrong?
(In reply to comment #1)

I used this one:
for (var i = 0; link = document.getElementsByTagName('a')[i]; i++)
as
for (var link in document.getElementsByTagName('a')) assigned indexes only.


> -                       downloadLinks[i]['param' +
> parameterDetails[0].charAt(0).toUpperCase() + parameterDetails[0].substring(1)]
> = parameterDetails[1]
> 
> why this? downloadLinks[i].mozParams = Array();
> downloadLinks[i].mozParams['name1'] etc. sounds cleaner cause you can easly
> iterate through it, am I wrong?

Sure, I was thinking about it but I thought it would be easier this way to get the value of a specific parameter. On mozilla.com the url is:
product=firefox-2.0.0.6&os=win&lang=pl
However on mozilla-europe.org it is:
lang=pl&product=firefox-2.0.0.6&os=win

I needed a simple solution to put all the prameters in this order:
'/download-tracking/' + lang + '/' + product + '/' + os

That's why I don't hold them in an array like this:
[ [lang, pl], [product, firefox-2.0.0.6], [os, win] ]
(which on mozilla.com would look like this:
[ [product, firefox-2.0.0.6], [os, win], [lang, pl] ])

Currently I create 3 properties for each download link. With your solution, I'd create 3 properties and an empty array. Is this OK?

Looks a lot cleaner though.
Attachment #275761 - Attachment is obsolete: true
Attached file Corrected script (obsolete) —
Ooops, I forgot to remove some IE-debug code the last time.
In this version I also got rid of .length in the for loops, as Pascal suggested.
Attachment #275768 - Attachment is obsolete: true
Blocks: 392342
Hey guys,

I was waiting to address this bug until the new download button changes were finished.  I pushed the changes to mozilla-europe last night (and will push mozilla.com this week).  If you look at the source of the pages, you'll see it's a significant change, but a lot simpler on the backend and will make pushing new products out easier.  If you adapt your script to the new code, I don't have a problem adding it.

pkim - any objections?
I've tried to make the script as portable as possible, and the only thing you change in it is the regexp of the download link. The function installTrackers() can put the trackers on any kind of links (I'm going to propose to use it in bug 393056 as well), and for the download links it takes the following form:

installTrackers("download.*?mozilla.org|download.html", urchinTracker);

The regexp matches the links pointing to download.mozilla.org, download2.mozilla.org etc., as well as the download.html file linked on http://www.mozilla.com/en-US/firefox/all.html.

I'll update the script so that it additionally passes the UA info and attach it to this bug.
Here is the version of the script which adds '/using:$browser' at the end of the fake tracking URL. The URLs look like this one for example:
/download-tracking/fr/firefox-2.0.0.6/win/using:firefox2
(for a windows French firefox 2.0.0.6 build downloaded with Firefox 2.*.

This code can be inserted into the /js/util.js file, which is linked to on every mozilla.com page.

The purpose is twofold:
1. have the installTrackers() function available site-wide (useful for bug 393056),
2. put the urchinTracker function pointers (triggered with click events) on every download link throughout the site. 

See description of this bug to see why the 2nd objective is important. We could try to fix Urchin instead, but I'm not sure if it's worth the time, with the replacement on its way.
Attachment #275778 - Attachment is obsolete: true
Hmm, on second thought the code for bug 393056 will have to be a different one, and we won't probably use installTrackers() for anything else than download links. I guess it should be named installDownloadTrackers() then.
installTrackers() changed to installDownloadTrackers()
Attachment #277729 - Attachment is obsolete: true
Small changes to make the script similar in structure to the one in attachment 277878 [details] in bug 393056.
Attachment #277731 - Attachment is obsolete: true
Attachment #277879 - Flags: review?(clouserw)
Comment on attachment 277879 [details]
installDownloadTrackers() with browser detection

An awful typo:
   ){};
Sorry :(
Attachment #277879 - Flags: review?(clouserw)
Now, it should be OK.

Wil, r?
Attachment #277879 - Attachment is obsolete: true
Attachment #278094 - Flags: review?(clouserw)
Comment on attachment 278094 [details]
installTrackers() without an ugly typo

Removing review request from this bug. See bug 392342 for further discussion.
Attachment #278094 - Flags: review?(clouserw)
Assignee: nobody → smalolepszy
The bug has been fixed with the resolution of the bug 392342.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Component: www.mozilla.org/firefox → www.mozilla.org
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: