Proposal: Add more tracking data to our statistics by running a small JavaScript on the client's computer. This data is fed back to drupal and tracked by user.

I started this project when I was looking at phpmyvisites.

I copied a lot of the JavaScript from that app over and added some stuff for computing the user's connection speed.

The javascript and data collection code seems pretty well finished. The next step is reporting.

I'm providing these patches as a preview version. I would be interested to know what other data people would like to collect. It currenlty collects java, os, screen res ,lang, director, flash, pdf , quicktime ,realplayer , wma, and connection speed.

Comments

mfredrickson’s picture

Status: Needs work » Needs review
StatusFileSize
new10 KB

Ok. I'm calling it done for now. I would appreciate reviews of this code. Attached is a tar.gz with the patch and the new files.

In your review, please understand the goal of this script is to gather information on users that cannot be discovered from PHP requests. If the script captures redundant data or is missing something obvious, please let me know.

Additionally, security is not my strong point. Since I am storing values from an HTTP Get directly into the database, I know I need to check that data. I've used the filter_xss option, but if there is a better method, please suggest it.

Finally, the connection speed stuff is still under development. I need to test it some more. It seems somewhat unreliable in my tests, but I've just uploaded this new version to a production system, so I'll have more data soon.

Thank you.
-Mark

Bèr Kessels’s picture

please post real patches, in plan text.
your tarball seems broken and makes reviewing a lot harder then it should be. http://drupal.org/difandpatch

Bèr Kessels’s picture

Status: Needs review » Needs work
mfredrickson’s picture

StatusFileSize
new7.89 KB

Ok. Attaching the patch to this post. The .js, .jpg, .install files will be in the next 3 posts.

mfredrickson’s picture

StatusFileSize
new3.55 KB

.js file

mfredrickson’s picture

StatusFileSize
new546 bytes

.install

mfredrickson’s picture

StatusFileSize
new3.59 KB

.jpg file (for testing the connection speed)

mfredrickson’s picture

Status: Needs work » Needs review
Bèr Kessels’s picture

Version: 4.7.x-1.x-dev » master
Status: Needs review » Needs work

I tested this, and I like it.
However, this introduces a privacy issue too, so I am thinking of some ways to switch this off.

One option is to make it a tiny module, xstatistics_js.module, that depends on xstatistics if you wish, mfredrickson, I will grant you CVS permissions once submitted, so that you can maintain that yourself.
The other option, is to introduce a setting, something like "report user information", so that peopel can switch this on or off.

I prefer the first option... :)

mfredrickson’s picture

I too prefer the first option. Do you want a contrib directory for xstats, or should this be a separate module in CVS?

Thanks for reviewing,
-Mark

sun’s picture

This gets more interesting the more users a site has. So size is a manner. Especially for things returning nothing. Please integrate a PHP Javascript Compressor that site administrators may execute once to compress their xstatistics.js file.

moshe weitzman’s picture

Looks like this never went in. If it is easy, how about adding this module. Thanks.

Bèr Kessels’s picture

let me clarify #9:

The patch in current state enforces everyone with xstatistics to track ALL user data. Many people including myself, may want only partial tracking of the data for several reasons, privacy and overhead being the most obvious reasons.

Therefore I think we should modularise this module: in this case simply make a patch and a module.
The patch would add basic support to xstatistics, the .module would extend that a lot.

Bèr

moshe weitzman’s picture

Anyone up for picking up this patch, and eventually doing the reporting side?