tracing visitors
My problem is a client has aproched me to design some animated banners for thier website which they are hoping to place on other website in a banner exchange of some sort. What I need to know is how can I find out which website has provided the the referal so that commisions can be made.
I have no experience with my SQL so I am looking for something quich to learn or an off the peg script preferably a free one.
Abhishek Reddy posted this at 13:53 — 18th December 2004.
He has: 3,348 posts
Joined: Jul 2001
Have a look through hotscripts.com for ad management and referral type scripts. Even if you don't use them, you could learn from the code.
I believe you can get the referring path from the HTTP_REFERER variable. In PHP you would uses $_SERVER["HTTP_REFERER"]:
CptAwesome posted this at 18:58 — 20th December 2004.
He has: 370 posts
Joined: Dec 2004
http://www.plebian.com/news.php?artc=4
karmaman posted this at 23:55 — 26th December 2004.
He has: 82 posts
Joined: Nov 2003
Thanks for the steer to hot scripts, just to clarify,all I need is to know which site has provided the clickthrough from a banner of the clients which is placed on thier web site.
CptAwesome posted this at 00:45 — 28th December 2004.
He has: 370 posts
Joined: Dec 2004
2 ways
1: ID
This is what I would consider the more accurate, and better method. Assign each person who used the banner a customer ID of sorts (some random 5 digit number?) send them to a script that register's the click, and then forwards them to the appropriate place using the php header() code.
with this, you'd need to have maybe 3 text files, or a single database table with 3 columns, in fact, you'd only techincally need 2, but ID looks better than the full http string. So the banner ad links to http://www.domain.tld/clickthru.php?id=62477 the script is pretty short (something like this):
<?
$id = $_GET['ID']; // this makes sure that you are only getting the ID from the ?ID=
/* then you'll need some code to pull the 3 pieces of information from the 3 databases about the hits, this can be done with something like MySQL or just a textfile (but that's insecure)
Now, lets say you have the array with the 3 pieces of info, the ID is the key, and the number of hits, and the URL are values you'd end up with an array like this:
array [62477][hits] = <a href="http://www.advertiser.com" class="bb-url">advertiser.com</a> // (or you can assign friendly names to them
[hits] = 1247
*/
So now you could go
$array[$id][hits]++;
/*code to save the processed info to the database*/
$go = "http://www.yourwebsite.com";
header(location:$go);
?>
2: http_referer
Referer is a slightly less accurate because of differences in browsers. Also, you'd be getting hits that aren't from the banners, and you'd have more info to go through. For basic tracking of this type, almost without fail I reccommend this one: http://www.plebian.com/news.php?artc=4
karmaman posted this at 11:41 — 29th December 2004.
He has: 82 posts
Joined: Nov 2003
Thanks for the reply ctp Awesome I am still trying to work out what it all means as I have no knowlage of my sql yetand it has gone a bit over my head but many thanks anyway.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.