Welcome Guest, Not a member yet? Register   Sign In
Daily unique hits on pages
#1

[eluser]Unknown[/eluser]
First of all, Greetings to community of the best framework around. Smile

My question is as follows:

I am currently building a Real Estate advertisement website and I need to track unique daily visits for every advertisement.

And what concerns me the most is how to properly log the user. I checked the input class -> ip_address, well it works fine, but how do I log separately users who are behind e.g. router?
#2

[eluser]andyy[/eluser]
I would use
Code:
$this->input->ip_address();
in conjunction with cookies. This way when a user needs to be logged, you can check for a cookie. If no cookie is present then log them as a unique visitor and plant a new cookie. If a cookie is present, log them as a returning visitor. There's also a few other things you could do with the cookie but that may depend on your application.

This applies to multiple users behind a router with NAT as well because the presence of a cookie differentiates unique/returning visitors.
#3

[eluser]Twisted1919[/eluser]
[quote author="Battery" date="1293515390"]First of all, Greetings to community of the best framework around. Smile

My question is as follows:

I am currently building a Real Estate advertisement website and I need to track unique daily visits for every advertisement.

And what concerns me the most is how to properly log the user. I checked the input class -> ip_address, well it works fine, but how do I log separately users who are behind e.g. router?[/quote]
What you want is pretty hard to accomplish and to be 100% bulletproof.
Think that, there are connections behind proxies (100% anonymous proxies or just partial) and it is very hard to determine the real IP of a user coming via a high anonymity proxy.
I don't know if you are familiar with TOR ( http://www.torproject.org/ ) but it worth a look to understand how proxy works .
Also, the $_SERVER['HTTP_X_FORWARDED_FOR'] should give you a hint.

If you figure it out on what's the real ip address, even if it is forwarded, then, using the obtained IP + Browser user agent should be more than enough .

P.S: As far as i know, MYSQL is not recommended for these kinds of scripts, but i might be wrong, it is also a thing that you will need to investigate .




Theme © iAndrew 2016 - Forum software by © MyBB