Track Page Views with jQuery?
I have created an online magazine (that I hope will take off someday) using wordpress. I would like to be able to track the number of page views of each item withou开发者_如何学编程t using a wordpress plugin.
What is the best solution??
Should I use jQuery to track page views and then insert that data into a custom wordpress table?
Or is it possible to use google analytics and then gather the require information from that?
Note: I will use the information to display 'Popular Posts', 'Top Categories', etc. on the site.
Any help would be greatly appreciated.
No need to use jQuery; Google Analytics will track all pages, as well as entry and exit URLs. You'll have more info than you can use.
As for popular posts and categories, why reinvent the wheel?: WordPress › Most Popular Posts « WordPress Plugins or any number of other plugins and widgets.
Edit 2/26/10:
Your question was probably downvoted because you're not clear about why you want to use jQuery, and you're confusing a perceived need for Ajax with a need to count page views and display popular posts and categories.
You're going to spend far more time creating a plugin or code to do what you want than using what's already out there. The popular post and category plugins have tens of thousands of downloads, and I doubt that they are bloated and buggy. Search the WordPress Support Forums or check a plugin's author's own forums for help with a plugin. And if you do want to write your own code, it's a good idea to start with some code that already exists in the form of a plugin or code available in the forums.
精彩评论