开发者

Best way to implement supplemental analytics

I want to be able to allow my writers to see how much traffic their articles are getting. I can do this in Google Analytics but can't figure out how to share this data with them without giving them access to all the data so I was thinking of adding another analytics service that would insert a unique code for each author on their articles. I already have the GA code and quantcast cod开发者_如何学Pythone so I don't want to bog down my site much more. Should I use a pixel tracker or javascript tracker?

UPDATE: Here is the code I use in analytics to track my authors.

var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}
<?php if ( is_singular()) { ?> 
pageTracker._trackEvent('Authors','viewed','<?php the_author_meta('ID'); ?>'); 
<?php } ?>


you could use a custom field to track the writers by a unique id that they probably have. Then you could use GA's api to pull data where custom field value = unique id and display it in their profile or wherever you want them to see it.


One option would be to use a server-local Redis instance and use the PHP Redis library to increment a local counter using the author ID and article IDs.

For example, if in redis you use a sorted set with AuthorID as the redis key, and use the article ID (or however you identify an article) as a member that you increment using zincrby for each load you'll have the data readily available and under your control. You could then have a PHP page that pulls the author's data from Redis and display it in whatever format you need. For example you could build a table showing them traffic for each of their articles, or make pretty graphs to display it. You could extend the above to do per-day traffic (for example) by using a key structure of "AUTHORID:YYYY-MM-DD" instead of just author ID.

The hit penalty for tracking this is much lower than reaching out to an external site - it should be on the order of single-digit milliseconds. Even if your Redis instance was elsewhere the response times should still be lower than external tracking. I know you are using GA but this is a simple to implement method you could consider.


This slightly depends on how many authors you have and your level of involvement, main type I would use is either

Create a separate view per author and filter in his / hers traffic Use a google docs plugin to pull down authors data and share Use the API to pull down relevant information

Happy to give mor specifics if you could guide in more details what you want

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜