如何使用google-analytics和php跟踪下载页面? [英] How to track a download page with google-analytics and php?

查看:103
本文介绍了如何使用google-analytics和php跟踪下载页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在php中有一个下载页面,执行一些检查后会返回一个文件,而不显示任何html:

 标题'Content-Description:文件传输'); 
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);

现在我想用google-analytics跟踪此页面。在不显示html的情况下达到此目的的最佳方式是什么? / galvanize-google-analytics-without-javascript /rel =nofollow noreferrer> http://www.acleon.co.uk/posts/galvanize-google-analytics-without-the-javascript/ 这里下载课程。

显然,开发人员仍然支持它,因为他刚刚在2天前评论了错误修复。


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?

解决方案

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.

这篇关于如何使用google-analytics和php跟踪下载页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆