What is the purpose of the script? Will it display info on the pages?
If it's just for counting and "off-line" analyzing, I would go for a Custom Log (you do run Apache, don't you :) and do/find a log-analyzis script.
Maybe mod_usertrack (i.e if you run Apache) is what you need.