Tracking website visitors
A fairly unobtrusive way to track unique website visitors is to use the userid
module. This module sets cookies that are used to identify unique clients. The value of these cookies is referenced by the $uid_set
variable. When that same user returns to the site and the cookie is still valid, the value is available in the $uid_got
variable. An example of how to use these cookies is as follows:
http { log_format useridcomb '$remote_addr - $uid_got [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent"'; server { server_name .example.com; access_log logs/example.com-access.log useridcomb; userid on; userid_name uid; userid_domain example.com; userid_path /; userid_expires 365d; userid_p3p 'policyref="/w3c/p3p.xml", CP="CUR ADM OUR NORSTA NID"'; } }
These directives are summarized in the following table:
Userid module directives |
Explanation |
---|---|
|
This directive activates the... |