![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
If I have a link from my site A to someone else's site B, How can I determine who has got to site B through my link on site A? This would be without any co-operation from site B, by the way. |
#3
| |||
| |||
|
|
If I have a link from my site A to someone else's site B, How can I determine who has got to site B through my link on site A? This would be without any co-operation from site B, by the way. |
#4
| |||
| |||
|
|
Big Bill wrote: If I have a link from my site A to someone else's site B, How can I determine who has got to site B through my link on site A? This would be without any co-operation from site B, by the way. You'd need to log it via scripting. There's a couple of ways to do this: a href="/redirect.php?url=www.domain.com">text</a a href="/redirect.php?id=1">text</a In the first example above we just redirect to the domain passed in after logging it. In the second example we pass an id number which is then looked up in the database (or even stored in the script) and then redirect to the appropriate url after logging it. A second approach is like this: a href="http://www.domain.com" onclick="foo(this); return false;">text</a and then the "foo" function would look something like this: function foo(a) { window.location = "/redirect.php?url=" + escape(a.href); } This preserves the direct link to the other site for search engines but invokes the onclick event which sends the user first to our redirect script for logging purposes. If they don't have javascript then they'll still be redirected but there won't be any logging. Using the "id" idea you could do it like this in javascript instead: a href="http://www.domain.com" onclick="foo(1); return false;">text</a function foo(id) { window.location = "/redirect.php?id=" + id; } |
#5
| |||
| |||
|
|
On Fri, 10 Jun 2005 11:15:34 +1200, Chris Hope blackhole (AT) electrictoolbox (DOT) com> wrote: Big Bill wrote: If I have a link from my site A to someone else's site B, How can I determine who has got to site B through my link on site A? This would be without any co-operation from site B, by the way. You'd need to log it via scripting. There's a couple of ways to do this: a href="/redirect.php?url=www.domain.com">text</a a href="/redirect.php?id=1">text</a In the first example above we just redirect to the domain passed in after logging it. In the second example we pass an id number which is then looked up in the database (or even stored in the script) and then redirect to the appropriate url after logging it. A second approach is like this: a href="http://www.domain.com" onclick="foo(this); return false;">text</a and then the "foo" function would look something like this: function foo(a) { window.location = "/redirect.php?url=" + escape(a.href); } This preserves the direct link to the other site for search engines but invokes the onclick event which sends the user first to our redirect script for logging purposes. If they don't have javascript then they'll still be redirected but there won't be any logging. Using the "id" idea you could do it like this in javascript instead: a href="http://www.domain.com" onclick="foo(1); return false;">text</a function foo(id) { window.location = "/redirect.php?id=" + id; } Thanks Chris I don't know if I can run php. I'll ask. |
You could use asp, perl or whatever you are comfortable /
#6
| |||
| |||
|
|
Thanks Chris I don't know if I can run php. I'll ask. Doesn't have to be php - I just needed some sort of extension in my filenames You could use asp, perl or whatever you are comfortable /able to use. |
![]() |
| Thread Tools | |
| Display Modes | |
| |