Analyze Categories Within 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? 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. 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!

 

File this one under “analyze categories wordpress”

Tom McCoy

Tom McCoy

An avid people watcher, Tom has always been fascinated by the way humans perceive and interact with the world. This, combined with an eye for style, led to a successful career of enhancing the way we appeal to customers.

As a consultant, entrepreneur and artist, he offers design & marketing expertise to anyone willing to listen to him ramble like a mad scientist. In his spare time, Tom likes to work with his hands – painting works of art, fixing up old cars & old houses.

Check out his LinkedIn profile for more information!
Tom McCoy

Latest posts by Tom McCoy (see all)

Share this article:
Facebooktwittergoogle_pluspinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *