Jun
10th

Using Campaigns to track Category Popularity in WordPress and Google Analytics

Happy New Year! Marketing Technology finds and reports on the latest technology that will enable your business to effectively market to your audience, for acquisition or retention strategies. Subscribe now the Marketing Technology Blog RSS feed or to the Marketing Technology Email to have new content sent directly to your inbox. You'll also find my other business blog helpful, Social Media Domination.

In my last post, I discovered a means of tracking WordPress categories by dynamically passing the category names in the script code for Google Analytics. The problem with the approach is that each time you instantiate the tracking function, it results in a page view. So, if you have multiple categories identified, you wind up executing multiple page views. Yuck!

So I did some digging and identified that you can set up a campaign in Google Analytics and capture the category names as keywords for that campaign. With some minor changes in the code, you can easily build a campaign, called “Category”.

Modifying your Analytics Code

Within your site’s footer, you will find your Google Analytics script tag:

<script type="text/javascript">
_uacct = "UA-xxxxxx-x";
urchinTracker();
</script>

And replace that with this code (be sure to substitute your UA- code in lieu of the xxxxxx-x):

<script type="text/javascript">
_uacct = "UA-xxxxxx-x";
<?php if (have_posts()) { while (have_posts()) : the_post(); if($post==$posts[0]) { ?>
_uccn="category";
_ucsr="post";
_ucmd="request";
_ucct="1.0";
<?php $kwd = ""; foreach((get_the_category()) as $cat) { $kwd = $kwd.$cat->cat_name.","; } ?>
_uctr="<?php echo $kwd; ?>";
<?php } endwhile; } ?>
urchinTracker();
</script>

You must now set up a custom filter for your campaign! Within a couple days, you’ll be able to track campaigns in Google Analytics! The campaign name will be “category”, the ad source will be “post”, the ad type will be “request” and the version will be “1.0″!

Google Analytics Campaigns

RSS feed | Trackback URI

7 Comments »

2007-06-10 11:56:38

[...] Subscribe to Feed to Email « What is Jumping the Shark? Using Campaigns to track Category Popularity in WordPress and Google Analytics » Jun [...]
 
2007-06-10 17:00:17

[...] is using campaigns in Google Analytics to track the popularity of categories on his website. This is an absolutely brilliant idea, and one [...]
 
Comment by Technical Itch
2007-06-11 02:08:32

Great tip Doug. This just shows the power of Google Analytics. I’ll certainly be trying this out soon.
 
2007-07-05 02:14:13

[...] Karr neuvoo miten WordPress-blogin juttujen aiheiden (kategorioiden) suosiota voidaan seurata asettamalla Analyticsissä sitä varten kampanja. Menetelmän etu on siinä, että se ei tuota tilastoihin ylimääräisiä näyttökertoja. [...]
 
Comment by Fred B
2007-08-31 07:43:21

Are…

_ucsr=”post”;
_ucmd=”request”;
_ucct=”1.0″;

…all required or can I get away with just adding a campaign name and campaign terms?

_uccn=”keywords”;
_uctr=”list,of,keywords”;

 
Comment by Fred B
2007-09-03 06:47:46

Thanks Doug, I’m trying to follow your instructions but I’m getting lost at creating the custom filter. How did you set yours up?
Comment by Douglas Karr
2007-09-03 07:44:47

Hi Fred,

I’m still fine-tuning and have changed quite a few things in my filters since writing this. You won’t believe it… but I can’t remember how I set it up! (Doh!) I need to do some reverse engineering.

Unfortunately, Google Analytics has some terrible documentation!

Doug

 
 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

My Comment Policy: I moderate comments. Please be patient:

  • Spam will happily be destroyed.
  • Use your real name, not some keywords. Otherwise it will be destroyed.
  • Mean comments aren't necessary. If I don't post them I will reply personally to let you know why.
  • Lewd comments will be edited, I don't want my readers leaving because of offensive content.
Great debate, criticism and colorful commentary is always appreciated and approved!