Track hits on a link?

M

Mabden

brucie said:
Kisses brucie, but those seem like whole apps, some costing $100. The
freebie I looked at had about 10 ASP scripts with logins, mySQL stuff, and
everything. Way overkill for my little Palm PDA game (a seen on
http://www.sitenook.com/ ).

I guess I could make the link go to its own asp file and use some
server-side redirect. So my new question is how can I "force" or "push" a
download from an ASP file.

index.htm has:
<a href=http://www.sitenook.com/ishido.asp> Download Ishido.Zip </a>

ishido.asp has:
Dim referer, browser, ip
referer = Request.ServerVariables ("HTTP_REFERER")
browser = Request.ServerVariables ("HTTP_USER_AGENT")
ip = Request.ServerVariables ("REMOTE_ADDR")

' code to save this stuff, I get this

' code to push the zip - How?

Just a hint would do...
 
B

brucie

in post: <
Mabden said:
Kisses brucie, but those seem like whole apps, some costing $100.

asp Creating a Click-Through Tracking System tutorial
http://www.4guysfromrolla.com/webtech/012901-1.shtml
The freebie I looked at had about 10 ASP scripts with logins, mySQL
stuff, and everything.

you need something to store the stats, if not a db then a flatfile.
I guess I could make the link go to its own asp file and use some
server-side redirect. So my new question is how can I "force" or "push" a
download from an ASP file.

no forcing or pushing involved. you just link to the script passing a
variable to identify the file the visitor wants to download (assuming
there is more than one file to download) not to the downloadable file
itself. once the script has done its goodies it sends a location header
to the requested file.
 
M

Mabden

brucie said:
in post: <

asp Creating a Click-Through Tracking System tutorial
http://www.4guysfromrolla.com/webtech/012901-1.shtml


you need something to store the stats, if not a db then a flatfile.


no forcing or pushing involved. you just link to the script passing a
variable to identify the file the visitor wants to download (assuming
there is more than one file to download) not to the downloadable file
itself. once the script has done its goodies it sends a location header
to the requested file.


Maybe I didn't get what you were saying? If so bear with me...

I don't think I'm explaining what I mean. I have no problem tracking the
users who hit my site. A flat text file is fine, as I use a Perl script to
view hits. But now I have added a link to a zip file (one zip file,
containing one file). I want to know when someone has clicked on the
download link, which just downloads the file. I realize I could make a
second page that the link goes to, so I can use ASP to write more info to a
file (DB, flat file, whatever), but the point is, the user has clicked on a
link and expects it to "just download". They don't want to have to click
ANOTHER link to "really" download the file. I just want to capture the fact
that they clicked on the original link on my main page.
...it sends a location header to the requested file.
This may be the piece I need. But I don't understand what this means.


I'm guessing that there's no way. I hoped someone would tell me about a
JavaScript onclick function or
something...
 
B

brucie

in post: <
Maybe I didn't get what you were saying?

<a... /download.asp>

1. visitor clicks link

download.asp file:

2. get the variables you want (IP, referer etc)
3. open stats file
4. write variables to stats file not forgetting to increment count by 1.
5. close file.
6. send a location header for the file being downloaded at the end of
your script to the browser (in php it looks like this):

header("location: http://www.example.com/the-file.zip");

7. browser downloads file
8. write a script to read and format your stats file so it looks pretty.
the user has clicked on a link and expects it to "just download".

thats what happens with the above, your fun giggly stats thingy is
transparent to the visitor. they click the link the file starts
downloading. easy.
I hoped someone would tell me about a JavaScript

JS isn't suitable for this.
 
M

Mabden

brucie said:
in post: <


<a... /download.asp>

1. visitor clicks link

download.asp file:

2. get the variables you want (IP, referer etc)
3. open stats file
4. write variables to stats file not forgetting to increment count by 1.
5. close file.
6. send a location header for the file being downloaded at the end of
your script to the browser (in php it looks like this):

header("location: http://www.example.com/the-file.zip");

7. browser downloads file
8. write a script to read and format your stats file so it looks pretty.


thats what happens with the above, your fun giggly stats thingy is
transparent to the visitor. they click the link the file starts
downloading. easy.


JS isn't suitable for this.

Well that's fantastic! I've never heard of the location header. I will look
into it and I think it will work great. I'm assuming ASP can do the same
thing as PHP (since it's all HTML at the browser end)! Thanks very much for
the hand-holding. I'm always amazed at getting a straight (excuse the
expression) answer on a
newsgroup. ;?)
 
B

brucie

in post: <
Mabden said:
Well that's fantastic!

and easy peasy
I've never heard of the location header.

14.30 Location
The Location response-header field is used to redirect the recipient
to a location other than the Request-URI for completion of the
request or identification of a new resource. [...]
http://www.ietf.org/rfc/rfc2616.txt
Thanks very much for the hand-holding.

i cant wait until we get to the heavy petting.
 
M

Mabden

brucie said:
in post: <
Mabden said:
Well that's fantastic!

and easy peasy
I've never heard of the location header.

14.30 Location
The Location response-header field is used to redirect the recipient
to a location other than the Request-URI for completion of the
request or identification of a new resource. [...]
http://www.ietf.org/rfc/rfc2616.txt
Thanks very much for the hand-holding.

i cant wait until we get to the heavy petting.

<blushing>
Gee, no one ever asked before. But I feel like such a newbie...

Will you still respect my code in the morning...
 
D

Dennis Marks

Mabden said:
I have a page that has a game on it, and I want to track how many people
download the file. I know how to track hits to the page, but can I track
clicks on the link itself?

Site: http://www.sitenook.com/
Link: http://www.sitenook.com/ishido.zip

The link is a Palm PDA game, so don't waste your time if you don't have a
color Palm device.

Why not just transfer to a new web page that has it's own counter and
starts the download automatically. Many archives use a method like
that. There is a message stating that if download doesn't start
automatically please click here.
 
G

Greg Schmidt

I have a page that has a game on it, and I want to track how many people
download the file. I know how to track hits to the page, but can I track
clicks on the link itself?

Site: http://www.sitenook.com/
Link: http://www.sitenook.com/ishido.zip

The link is a Palm PDA game, so don't waste your time if you don't have a
color Palm device.

Do your logs not already show how many hits ishidio.zip has had? Seems
like this information should already be at your fingertips.
 
M

Mabden

Dennis Marks said:
Why not just transfer to a new web page that has it's own counter and
starts the download automatically. Many archives use a method like
that. There is a message stating that if download doesn't start
automatically please click here.

Yes! Ok. ...and how do I start the download automatically?

brucie suggested "The Location response-header field" which I'd never heard
of, and I am going to look into next. Is that what you would use?
 
M

Mabden

Greg Schmidt said:
Do your logs not already show how many hits ishidio.zip has had? Seems
like this information should already be at your fingertips.

Well, I'm hosted by another company, not on my own box. They probably have
all kinds of info, but I'm not paying them to share it with me. I was just
looking to pop some data into a text file so I could count the number of
d/l's without involving my hosting company. I've been given a hint that I
should use "The Location response-header field" on a separate page. So I
will try that. Any other advice?
 
B

brucie

in post: <
Yes! Ok. ...and how do I start the download automatically?

somewhere on the new page:
brucie suggested "The Location response-header field" which I'd never heard
of, and I am going to look into next. Is that what you would use?

not if you want to display a new page and then start a download
automatically.
 
D

Dennis Marks

Mabden said:
Yes! Ok. ...and how do I start the download automatically?

brucie suggested "The Location response-header field" which I'd never heard
of, and I am going to look into next. Is that what you would use?

That is a good question. I never considered it. I just went to
www.versiontracker.com to see what they do and the link points to the
downloaded file but something server-side seems to also load a web
page.

That is beyond my knowledge.

Is there a way to use <link> or <embed>? How is background music
loaded. Can the same method be used? I'm just brainstorming. None of
these may work.
 
B

brucie

in post: <
That is a good question. I never considered it. I just went to
http://www.versiontracker.com to see what they do and the link points to the
downloaded file but something server-side seems to also load a web
page.

they use a refresh header. non standard but seems to be supported by
everyone although it can be disabled.
Is there a way to use <link>

needs to be clicked
or <embed>?

proprietary MS

i think an <iframe> (over 10x10px so filters don't think its a webbug
and kill it) or a refresh header would be the most reliable but a link
to manually start should still be included.
 
T

Toby A Inkster

Mabden said:
Any other advice?

Don't know much about ASP, but here's a Perl solution:

============== download.cgi ==============
#!/usr/bin/perl
$filename = 'foobar.zip';
$size = (-s $filename);
$n = `cat count-$filename`; $n++;
system ("echo '$n' > count-$filename");
print "Content-Type: application/zip\n";
print "Content-Length: $s\n";
print 'Content-Disposition: attachment; '
. "filename=$filename\n\n";
system("cat $filename");
==========================================

Not 100% reliable (really needs to do some file locking), but should do
the job.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top