There's no 100% reliable way to get this information and still keep the site available to the general public. Most techies are interested only in the hits the server takes, which means the access logs are quite sufficient. Your best option is to generate a unique ID number for each visitor and store it in a cookie on the browser. This would let you build up a profile of each visitor, frequency of visits, etc. The only thing you have to watch out for are users that are unable or unwilling to accept cookies. The percentage is small but significant.

Also, lots of people tend to frown on cookies that "track" their movements, even if it's on one web site, despite the fact that the same information is typically available in the access logs keyed on IP. Watch what you do with these strange new powers.

As HTTP is state-less, any method to tack any sort of persistent or state information (either session-based or user-based) is a hack. The only "sure" way of knowing how many users visit your site is to have each user register, and use something like HTTP authentication to log them in. 99% of the time this is overkill and only serves to keep people away from your site. If you have a lot of content, though (like nytimes.com), you can afford to do this.


In reply to RE: How many unique people have viewed my website in the last month? by Fastolfe
in thread How many unique people have viewed my website in the last month? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.