I am developing a video streaming website. I want to count unique views on each video. I referred to some sites on internet and even asked some other programmers. They say either use cookies or session or IP address. But these things changes over time. Also if possible can we do this using MAC address of the user's machine? Also I came across a similar question here -> http://bit.ly/Qh1KNR. They say there is something like browser fingerprint that uses MAC address. So can you tell me what method is the best one?
-
I think something like this can not work. Consider the user that downloads a video on a PC and later the same user will download the same video on his smartphone. Whatever technique you use, these are two completely different users for your server - different browser, MAC, IP, etc. I guess the only solution would be to force users to logon and than track user-video downloads ... But I might be wrong – Ondra Oct 15 '12 at 11:20
-
@OndraMorský and even with users forced to login, you can't be sure a user does not have two accounts... – Guillaume Oct 15 '12 at 11:24
-
The MAC address of a user is not one of the factors known to a browser. You might be able to get this through JavaScript but that of course is not server-side. The Mac Address is not sent through a TCP packet. Now if you send it yourself within a TCP Packet that is entirely different. – Security Hound Oct 15 '12 at 11:49
5 Answers
Yes, all those attributes can change and there is no certain way to detect whether the same person has watched the video twice. Someone can watch it once in school and another time at home with different browsers and IP addresses.
You best bet is probably with IP-addresses, counting some people twice and skipping some people (because of NAT enabled routers).
Another way is to only allow registered users to watch videos and record what they have seen.

- 852
- 6
- 10
-
I know that logic that they might see from different places. But in my case users are the Machines. – Shiva Pareek Oct 15 '12 at 11:51
You can not track a user with fingerprint. What fingerprint does is to collect some information about the operating system, time zone, fonts installed, plugins,... In some cases may work, but is not 100% true. In some eviroments (like schools, universities, etc) the operating system, browsers and almost all configuration may be the same and it is imposible for you to track an user.

- 178
- 6
You could go deeper than just an IP address.
If this is just for tracking usage and not authentication then you can store an initial fingerprint of a user's browser based upon:
Using a plugin like: https://github.com/carlo/jquery-browser-fingerprint
- Plugins Installed & their versions
- Screen Size
- Operating System (Version)
You get the point. As the likelyhood of two users having the exact same resolution, plugins (versions included), operating system (patches etc) is relatively slim.

- 9,732
- 3
- 55
- 76
You can use Evercookie concept which stores cookie data on different storage location . If user clear browsing history or cookies , it will restore it cookies from different storage location . There is one drawback user must on javascript to create evercookie.

- 76
- 2
- 11
Why dont you store GUID along with some other parameter in cookies along with some MAC address of finger prints that will give you some control over the data to figure out the uniqueness

- 19,469
- 39
- 180
- 373