Jump to content

Best solution for storing unique visitor IP addresses


V

Recommended Posts

I'm looking to display most popular posts on my site based on unique visitors rather than comments or clicks. My initial idea was to store visitors ip addresses in the database and use that but I read somewhere that storing IP addresses in the DB isn't a good idea because it will slow down your website. What other alternatives do you think are good? Or does anyone know a good tutorial? I can't find anything noob-proof.

 

edit: does anyone know if this can be done with google analytics?

I'm not sure where you heard that about database slowing down, but I would assume that would depend entirely on how many visitors you have. I have databases that are well into the 10's of thousands of entries and it's not slowed down a bit ... if you write your code well, should be fine.

Thank you for the clarification!

 

@mrMarcus,

 

How do you mean user id? Via sessions?

Can you expand on:

 

display most popular posts on my site based on unique visitors rather than comments or clicks

 

Sure! I want to store IP addresses from all my visitors in my database. I'll have a special table named post_ips which will list all the IP address that visited each post in my site (using a post_id foreign key to relate the posts and ip addresses that visited it)

In my website's sidebar for example, I'll display "most viewed" or "most popular posts" by querying unique, non-duplicate IP addresses from each post. Very similar to how google analytics shows you the number of unique visitors to your site. I'm trying to develop the same system and display the posts with the most unique IP count. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.