views:

29

answers:

1

Hi,

I have a download page in php that after performing some checks returns a file, without displaying any html:

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=xyz.exe');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize(LOCAL_FILE));
readfile(LOCAL_FILE);

Now I'd like to track this page with google-analytics. What's the best way to achieve this without displaying html?

+3  A: 

Try this: http://www.acleon.co.uk/posts/galvanize-google-analytics-without-the-javascript/

Its called 'Galvanize' (Don't know who thought that one up). You can download the class here.

Apparently the developer is still supporting it too, as he just commented about a bug fix 2 days ago.

Chacha102