I am going to add page views count to my website, where views will be updated in the database. Previously, I have done similar think and I used users' ip address to determine unique views.
Now, I just wonder if I should use cookies instead. I can not understand which one is better. Or should I use both for more strictness?
Somebody with confident mind about this problem, please respond and I will accept your point of view. I just need a little bit more confidence to choose either one or second.
P.S. If you think there is better alternative to those two please be kind to tell me.
Thanks.
Use google analytics
Use somekind of http log reader/parser.
Take a look at http://www.phpmyvisites.us/
what happens when 5 PC's connect to your site from the same IP, let's say they are behind a wireless router, is that a good count ? what if the same person who viewed the page had an internet connection with dynamic IP like most broadband internet connections are today
cookies could do the job, but I'm not sure how to tackle this problem and why track at a client level where he navigated, cookies can also be deleted or blocked ...
an easy way would be to use google analytics or google webmaster tools
Related
I am trying to create a website which can track/analyze the visitor and gather as much information as possible about the visitor. I have already found services which were not free, but they have provided every piece of information about the user who is visiting the website.
Is there a solution for that which is free yet effective like the paid ones out there? Also, should I use client side or server side scripting? Which is more reliable?
The main reason that I'm trying to gather these information is because I'd like to know more about my website visitors and eliminate the fraudsters or cheaters by analyzing their information. Or is there another good solution for that?
I'm sorry if this is a weird question, I'm quite new in this field this is why I'd like to know more about it.
EDIT: I have already tried Google Analytics, but it is not really good in my case.
If you would like to Geo Locate your visitors, and discover their physical location based off their IP, MaxMind has a great service with a free option.
http://www.maxmind.com/en/geolocation_landing
I am developing a PHP application, only used by our employees in 3 diff locations. I want a when, whom, where log. I am getting only 3 unique IPs, since all of them using internet via proxy and chrome browser mostly. Is there any other unique value other than IP or Browser info? that should be record by javascript or PHP. I know there is a security problem of getting computername or local ip, but please suggest and anyother solutions.
Waiting for your valuable suggestions
You could use session/cookies? But for something like this, you should really have a log-in sort of system.
You may consider using Google Maps Geolocation to find and store the zipcode:
https://developers.google.com/maps/documentation/business/geolocation/
Is there a way to make a reasonably secure system to vote without having to login. I now use cookies to set if the person has voted yet and also insert the users ip in the database.
If that user removes his cookies, he will be able to vote again. That's why I do a check if the user's ip exists in the database and if that IP has voted in the last 30 seconds. That way he'll have to remove his cookies and change his IP address to vote again.
I know there's no 100% failproof solution to this, but
is there a more secure way to do this?
There are two ways that could improve your results, but read and judge for yourself, if you need them:
More persistent cookies
There is the Evercookie project, which stores cookie-like information in a lot of places. It is much harder to delete than just normal cookies.
I personally think that this project should be considered a proof of concept and actually using it would be unethical
Better user recognition
Instead of just looking at the IP address in order to identify a returning visitor, you could use Browser fingerprinting. The EFF has shown with their Panopticlick project, that the combination of Browser version, OS version, installed add-ons etc. is often unique. The Piwik web analytics tool also uses this kind of user heuristics to tell visitors apart. I don't know the implementation, but it's FOSS and in PHP, so you should be able to find that part.
You can run with both of those solutions in unison - but it's still not very secure. You could go as far as blocking a subnet from voting (192.168.1.xxx) to prevent against dynamic IP changes, but then you're also blocking up to 254 people from voting - and it won't prevent against a proxy.
One method I've seen used quite a bit is making it look like you allow duplicate votes; i.e: show it on the end user's end that their duplicate vote has been counted, but don't actually count it in your own database.
But realistically, a login system is about the only relatively "secure" way of doing this - but if someone is determined enough, that can obviously be gamed too.
Hope this helps.
Eoghan
You could ad the
User agent (on short periods there's often little chance that 2 surfers have exactly the same : https://panopticlick.eff.org/index.php?action=log&js=yes)
But again ' if someone is determined enough, that can obviously be gamed too.'
I'm planning on storing the number of times an article / page has been viewed in a database. This is so that I can have a list of "most popular posts / articles" in Wordpress.
This was a good thread for similar question: How "View Count" is best implemented?
My question is: A person may view an article multiple times on the same day / week.
What is the industry best practice for counting the number of times an article is read by the same person?
And is there a way to solve multiple users being behind same IP Address?
Update
I'm not after the coding techniques for counting article / post viewes (session, cookies IP address, CGI etc).
I'm just wondering what logic is best to use for counting articles read by the same person over time?
For anonymous viewing, you can associate an IP address with an individual. For non-anonymous usage, you can use the credentials of a person to make sure that multiple viewings of the same page by the same credentials (i.e., individual) do not result in multiple increments to your view counts.
This can be a really complex problem to solve depending on what you are trying to do. I would suggest fist looking at google analytics or piwik which is some php application you install and use like google analytics.
If you need an in house solution then most likely you have to leverage cookies. There are two types of cookies. A simple cookie can be dropped when user is on page foo.com and the application is trying to set a cookie on foo.com. Another type of cookie is when you are viewing foo.com but another application is trying to create a cookie for bar.com. This is called a 3rd party cookie which sometimes is blocked. This is how services like google analytics track users.
There are other ways to find unique users. You can use ip address, browser signature, etc... The problem with these solutions are that many companies, universities, or other large companies are usually behind one ip address. You don't want to count a whole department as one person.
There other ways you can track users but these are advanced. (localStorage, flash, cache).
I would advise to use Google Analytics first. If this is not enough then you can pursue other options.
I recommend grabbing all the CGI environment variables like: these from the visitor, parsing them and adding them to a database. This will provide you with a better idea of return visitors.
Basically, I want to display local events to people on a page. So if you were from California you would have different things than someone from Florida. I am going to be using php for the rest of the project so php is a must.
I would prefer to get the data without having to ask the user for additional information. IF I have to ask for additional information, I would want to use a zipcode than I would save that zipcode to a database with their ip so I didn't have to ask again.
I would imagine the GEO IP functions would get you 90% of the way there, if not all the way.
How will you know the location of the person?
For example, you can't go by the ISP, as their ISP address may be in a different state than the user.
If they have to log in then you can know where they were when they logged in, but what if the are on a trip and so staying elsewhere, now your information is wrong.
That would be the first challenge.
Depending on how fine-grained you are trying to get will determine what your database looks like. For example, while I am going down a street, if I am using a mobile device, will you be able to use my GPS data to determine what gluten-free restaurant is close to me? Or is it based on a city or metropolitan area?
Are you using GPS data?
How will you get the local events to update your application?
There is a great deal of information left unanswered to be able to really give you a good answer.
Are you trying to guess the visitor's location? If that is what you want, see the PHP GeoIP extension or MaxMind GeoIP api. They both use the same database and offer free and paid databases.
One problem with this method is that the IP address does not guarantee an accurate location. It is often a good starting point though. You should make it easy for the visitor to correct their location.
A potentially more accurate method is to use the HTML5 geolocation api, but this is experimental and only supported in the latest browsers. Even with browser support, the site visitor needs hardware capable of finding their location or a plugin that allows them to set their own location. If you go this route you should have a fall back based on the GeoIP result.
You could look up their IP address in a geolocation database like other people have mentioned, and as everyone has pointed out, it's not foolproof but it should work most of the time.
You could also take a look at using Firefox's location-aware browsing, which again isn't foolproof -- yet it does accurately pinpoint my very house when I use it. Of course, this would only work for Firefox 3.0+ users, and only after they click the "accept" button, so it's obviously not without issues.
Whichever way you choose to go, just make sure there's an override somewhere! Your method might work 99% of the time, but if I'm in the 1% of people who are never shown the right information, that'd be really really annoying!