开发者

How to track a download page with google-analytics and php?

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 开发者_JAVA百科to track this page with google-analytics. What's the best way to achieve this without displaying html?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜