Posts: 2
Threads: 1
Joined: Oct 2016
I need to track downloads of a particular file posted on my site. I have the google analytics plugin, but it doesn't track the downloads. Help!
I need to get this up and running quickly.
Posts: 538
Threads: 12
Joined: May 2013
2016-10-28, 03:18:27
(This post was last modified: 2016-10-28, 03:19:12 by Bigin.)
You can never know for sure that the user has downloaded a file without any issues.
Maybe you will need to force the file download with PHP using header(), something like this:
Code:
...
header("Content-Type: $type");
header("Content-Transfer-Encoding: Binary");
header("Content-Length:".filesize($location));
header("Content-Disposition: attachment; filename=\"$file\"");
readfile($location);
...
And what you can do is to implement an additional step that must be executed after the file is successfully downloaded then you can track that step.
Posts: 3,491
Threads: 106
Joined: Mar 2010
Perhaps with the Hitcount and Download Interceptor plugins...
Posts: 2
Threads: 1
Joined: Oct 2016
(2016-10-28, 03:18:27)Thanks, but I don\t need to know about successful downloads, just attempts. Bigin Wrote: You can never know for sure that the user has downloaded a file without any issues.
Maybe you will need to force the file download with PHP using header(), something like this:
Code:
...
header("Content-Type: $type");
header("Content-Transfer-Encoding: Binary");
header("Content-Length:".filesize($location));
header("Content-Disposition: attachment; filename=\"$file\"");
readfile($location);
...
And what you can do is to implement an additional step that must be executed after the file is successfully downloaded then you can track that step.
Posts: 538
Threads: 12
Joined: May 2013
2016-10-28, 16:21:07
(This post was last modified: 2016-10-28, 16:21:47 by Bigin.)
More infos
How to Track Downloads in Google Analytics:
http://www.blastam.com/blog/how-to-track...-analytics
I didn't know the plugins that Carlos mentioned before, but if you are familiar with PHP see here the second Answer:
http://stackoverflow.com/questions/12295...oad-script
Or you can try this script:
https://github.com/iNamik/PHP-Download-Tracker
Posts: 1,247
Threads: 82
Joined: Feb 2011