StatCounter User Forum  
StatCounter Free web tracker and counter

Go Back   StatCounter User Forum > StatCounter.com > Help

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 06-25-2012, 09:47 AM
Warang Warang is offline
Junior Member
 
Join Date: Jun 2012
Posts: 1
Question How to count direct download links?

Hello everybody,

I recently found that direct download links aren't counted.

Example :
I give a friend a direct link to a file stored on my website.
I want it to be counted in StatCounter, but it's not.

Obviously, it's because there is no script loaded between the click and the download. So I thought that I could write a PHP script, like /download.php?file=example.png (which includes statcounter script) and that redirects on the file.

Do you think this is a gonna work, or will it just count as a view for download.php ?
Of course, i can name the title of the page according to file's name but that's not exactly what I want.

Thank you.
  #2  
Old 06-25-2012, 10:18 AM
Arne's Avatar
Arne Arne is offline
Moderator
 
Join Date: Sep 2004
Location: Lulea, Sweden
Posts: 5,467
Default

Quote:
Originally Posted by Warang View Post
Obviously, it's because there is no script loaded between the click and the download. So I thought that I could write a PHP script, like /download.php?file=example.png (which includes statcounter script) and that redirects on the file.
The reason it's not logged by Statcounter, is that there is no page with a counter code where the link is.

Your solution should work, if the page /download.php has the counter code and is loaded before the redirect. With not much more than the counter on the page it does not need much delay before redirecting. And a simple "meta refresh" tag in the header of the download.php (or html) file will do.

To redirect to the file, the syntax is nearly the same as reloading the current page: <meta http-equiv="refresh" content="2; url=example.png/">

The "2" for content is the time in seconds before it redirects.
Closed Thread

Tags
direct, download, links, stats

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:02 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.