Reputation: 1196
I have a web site on wordpress. I want to add a counter that counts unique visitors. Is this possible just using javascript? Is any server side script required? If server side script is required, how can I store the result count?
Upvotes: 0
Views: 3334
Reputation: 5937
Unfortunately Javascript won't do what you are asking. What you can do is use a .txt file or mysql table to store the count and connect using jQuery Ajax.
Server side scripting is required, you need information from the user to identify whether they are unique or not, this could be done by ip address.
If you want to count users for a site performance reasons and display in backend, Google analytics plugins are useful.
For a frontend display have a look at these: http://wordpress.org/plugins/tags/hit-counter
Or if you want to DIY: study this link, replace mysql with wpdb connection (wordpress method of connecting) http://coursesweb.net/php-mysql/register-show-online-users-visitors_t
Upvotes: 1