Best way to provide analytics to website users but only for their own pages
I'm building a blog of sorts. The client wants to provide analytics to users for their own posts, including views over time, location of viewers etc. Only the owners of a given post should be presented with information on that post.
My initial thought was to roll my own. Now I'm thinking perhaps the Google Analytics API is worth investigating and have also been looking at Mint.
Has anyone done this before, or does anyone have any advice on the best way to go about this?
thanks!开发者_运维百科
Edit: Just found Clicky and I really like the looks of it - does anyone have any experience with it?
It would be much easier to use Google Analytics than building your own tracking system as there's lots of issues to consider. You could send an id for the post to GA using a custom variable then get data back about it using the API.
Another option might be to investigate what can be done with piwik. It's an open source web analytics system similar to GA. It's got an API and could be modified if needed. It doesn't report on as much so you would need to check out if it does what you want. You would also need to host it yourself which might be an issue for server resources.
I think there are 2 ways to achieve this with Google Analytics.
One would be to use your own GA account on the blog, then use the Google Analytics reports API http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html to present post owners with their stats. Most likely a filter on the data (filtering by Page URL) will be enough, but you should carefully review what data you want to make available, as well as Quota policies for feed retrieval (if you are planning to do live queries). Be aware that a mistake could make critical data visible to all post owners.
Another option - if post owners have a dedicated piece of the site that they really own - would be to give them the ability to add their own Google Analytics account to their pages. That's what many blog platforms do for bloggers. EventBrite for example lets you do that for your Events.
A last option is to just present your log data - hits, referrals, time of days. etc. But a lot of data will be more difficult to get : Unique Visitors (requires cookies or some deduplication), Geographic data (that would require a database of geo ip locations, etc).
It all boils down to how critical these analytics are for your project, and how much control you want to have over the data....
The best way is using profiles and filters in Google Analytics. For the same web property you can create more profiles, in your case you should create a profile for every author, then if you have have the author name in the URL you can easily filter data traffic and include in every profile the data about the single author. If you have not the author information in the URL is more difficult but not impossible ;)
In this way you assign the user to his specific profile.
And remember to keep a master profile without any filter!
You will find a lot about custom filters and profiles, I suggest you to start with: http://www.google.it/search?ie=UTF-8&q=analytics+profile+filter
精彩评论