Analyze Categories In WordPress

WordPress offers a variety of tools for tracking usage statistics: YOAST, GA for WP, etc – but what if you want to see traffic for a particular category of post? How to analyze categories in wordpress?
Luckily, Google has implemented a new “Content Group” feature in Analytics. Here is an excellent summary from the website High Position:  http://www.highposition.com/blog/how-to-send-author-content-groups-wordpress-google-analytics/

Within GA, you simply create a new Content Group. Select the tracking method you wish to use and click “Done”. Next, you will need to modify the GA tracking snippet. Here is an example of the new code you’ll have to implement:

var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXX-X’]);
<?php
if (is_single()){
echo “_gaq.push([‘_setPageGroup’, 1, ‘”.get_the_author().”‘]);\n”;
$category = get_the_category();
if ($category && !empty($category[0]->cat_name)){
echo “_gaq.push([‘_setPageGroup’, 2, ‘”.$category[0]->cat_name.”‘]);\n”;
}
}
?>
_gaq.push([‘_trackPageview’]);

Notice the new code for gathering category info… this helps to analyze categories. The bad news is that this will only begin to collect data on categories once implemented. You won’t be able to see any historical stats. And there you have it, enhanced analysis for categories in WordPress!

Thanks for reading! While you’re here, don’t forget to visit my portfolio.

Tom McCoy
Latest posts by Tom McCoy (see all)
Share this article:
Facebooktwitterpinterestlinkedinmail

1 thought on “Analyze Categories In WordPress

Comments are closed.