tags:

views:

195

answers:

4

Is it possible to find out where the users come from? For example, I give a client a banner, and the link. The client may put the banner/link to any website, lets say to a site called www.domain.com.

When the user click the banner, is it possible to know where he coming from(www.domain.com)?

+5  A: 

Have a look at the HTTP_REFERER variable. It will tell you what site the user was on before he came to your site.

Marius
Users can tell their browser not to send the referrer information.
gnud
Users can also tell the browser to not display images. Nothing you can do about that
Marius
So what should I do? Using HTTP_REFERER? Is there any other methods?
bbtang
+3  A: 

Yes. You give the client a unique URL, like www.yourdomain.com/in/e10c89ee4fec1a0983179c8231e30a45. Then, track these urls and accesses in a database.

The real problem is tracking unique visitors.

gnud
Unique users? By IP? Altho dynamic IP users will give me trouble. Well, I like your unique URL ideas. I will consider it. Thanks gnud :)
bbtang
It's hard to know if another user is a new user, or the same one who followed the link again. Or a click-bot. That's what I mean by unique users.
gnud
A: 

See

 $_SERVER["HTTP_REFERER"]

Although that can't always be trusted as it's set by the client but you may not care in your case.

smack0007
A: 

The only chance is that you use a unique ID (as pointed out by gnud). This ay you can track the incomming links. Referrer may be altered/removed from browsers or proxies (many companies do that).

Using the IP to track unique visitors is a bad idea. AOL still pools the IPs and you might use different IPs every few minutes and with proxys yiur counting will be not very accurate.

I'd say, go with the unique ID.

Patrick Cornelissen