Track Subdomains in Google Analytics

With software as a service (SaaS) vendors like Compendium, you delegate a subdomain and host your blog on a different subdomain than your website. Commonly, this is accomplished with blog.domain.com and www.domain.com. Typically companies implement a totally separate account in Google Analytics to monitor the blog subdomain. It’s actually not necessary.

Google Analytics will allow you to monitor multiple subdomains within a single profile. To do this, you simply add a line of code to your current Google Analytics script:

<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._setDomainName(".example.com");
pageTracker._trackPageview();
} catch(err) {}
</script>

You’re not done yet! If you simply do that, you run the issue of identical paths being measured under a single URl in Google. So – if you have index.php on your blog and www subdomains, they’ll both be measured as index.php. That’s not good. As a result, you have to do some fancy advanced filtering in the account!

Login to Google Analytics and click Edit on your Google profile. Scroll down the page where you can add a filter and add an advanced filter with the following settings:
ga.png

Now your profile should distinguish the subdomain throughout all the Analytics Account.

Tracking Multiple WordPress Authors with Google Analytics

I wrote another post on how to track multiple authors in WordPress with Google Analytics once before, but got it wrong! Outside the WordPress Loop, you’re unable to capture the author names so the code did not work.

Sorry for the fail.

I’ve done some additional digging and found out how to do it smarter with multiple Google Analytics profiles. (Quite honestly – this is when you come to love professional analytics packages like Webtrends!)

Step 1: Add a Profile to an Existing Domain

The first step is to add an additional profile to your current domain. This is an option that most people aren’t familiar with but works perfectly for this type of scenario.
existing-profile.png

Step 2: Add an Include Filter to the New Author Profile

You’ll want to only measure page views tracked by authors in this profile, so add a filter for the subdirectory /author/. One note on this – I had to make “that contain” as the operator. Google’s instructions call for a ^ before the folder. In fact, you can’t write an ^ into the field!
Include-author.png

Step 3: Add an Exclude Filter to your Primary Profile

You won’t want to actually track all the extra pageviews by author in your original Profile, so add a filter to your original profile to exclude the subdirectory /by-author/.

Step 4: Add a Loop in the Footer Script

Within your existing Google Analytics tracking and below your current trackPageView line, add the following loop in your footer theme file:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
var authorTracker = _gat._getTracker("UA-xxxxxxxx-x");
authorTracker._trackPageview("/by-author/<? echo the_author(); ?>");
<?php endwhile; else: ?>
<?php endif; ?>

This will capture all of your tracking, by author, in a second profile for your domain. By excluding this tracking from your primary profile, you don’t add additional unnecessary pageviews. Keep in mind that if you have a home page with 6 posts, you’ll track 6 pageviews with this code – one for each post, tracked by author.

Here’s how the Author Tracking will look in that specific profile:

Screen shot 2010-02-09 at 10.23.32 AM.png

If you’ve accomplished this in a different way, I’m open to additional ways to track the author information! Since my Adsense revenue is associated with the profile, I can even see which authors are generating the most ad revenue :) .

Web 2.0 Information Overload

Overwhelmed with the amount of information, apps, and new solutions coming at you?  I know I am!  Call me silly, but some of the items I mention today may be old news to many, but with so much information out there, who can really keep up.  Unless you are Douglas Karr or Kyle Lacy – which by the way, I am convinced they don’t sleep!

I’ve started using some new organizational tools to keep all of the details in check.  Here are just a few that I find helpful:

  1. delicious_logo.jpgDelicious: Okay, okay, I know many of you reading this may already know about Delicious.  I’ve known about too, but until the world of social sharing evolved, it never had as much impact.  I love that I can bookmark and tag away and no matter what computer I am on, where I am at, I always have my favorites right there.  Not to mention a quick and easy place to find all of those links I want to remember.  Like a recent blog post, a webinar invite, or even an article.
  2. picnik-logo-spaced.pngPicnik: Again, marketers are creative people and we have to be able to design in a pinch.  I can design when needed, but when I want something quick, simple, and easy…I choose picnik!  Especially for those projects you want to spice up a bit without a lot of brain power.  Their interface is very easy to use and again like any web-based app….you can access your pics anywhere.
  3. feedburner.pngFeedburner: By now I am sure you are thinking, what rock has she been under?  Not so much….remember, I am a busy marketer juggling it all A-Z!  I need quick, I need simple, and I need to get back to it when in a pinch.  While I have always known and loved feedburner for the RSS capabilities, but I just recently learned of the ability to embed an email form in your blog as well.  And then the metrics, very cool that I will have all of these tools all within my Google platform everyday.
  4. google_apps_logo.jpgGoogle Apps: I don’t want to sound like a Google devotee because like so many other marketers I have always been bewildered by them just trying to improve my search.  However, at Delivra, we all work from Google Apps for everything and while I’m sure the cost savings are huge compared to any desktop software, I am impressed with the various applications from mail, calendar, sites (which we love!), Documents, you name it.  Now I know it isn’t perfect, but the accessibility and the fact that it doesn’t crash once a day has me sold.
  5. smartsheet-logo-180x56.pngSmartSheet: This is probably the only app that many of you may not know about.  I love SmartSheet as I am a constant list maker.  How else do I keep track of the thousands of things I do everyday?  In any event, the application helps me manage multiple to-do’s where I can rank them by priority, share with others, make edits anywhere, print or access wherever I might be.

There you have it, five simple tools that keep me from succumbing to information overload.  If you are a time starved marketer or simply time starved, incorporate some of these tools into your bag of tricks and you will be able to manage the load with the greatest of ease.  If not, consider them new hyperlinks to what you already know and love.

One Google Analytics Account, Multiple Domains

If you’re a franchise corporation, you might have multiple domains or subdomains but you wish to track traffic across all of them. This is possible by adding another profile within Google Analytics and appending a second profile tracker.

Here’s how to add a second tracking account to a website, and track across multiple subdomains:

<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-111111-1");
pageTracker._initData();
pageTracker._trackPageview();
var secondTracker = _gat._getTracker("UA-222222-2");
secondTracker._setDomainName("none");
secondTracker._setAllowLinker(true);
secondTracker._initData();
secondTracker._trackPageview();
} catch(err) {}
</script>

A few weeks ago I did some digging in Google Analytics and they actually promote the method of adding profiles to filter data as well. Perhaps you want to observe how many people visit your site from within your company versus external visitors. You can put a filter for your IP addresses on one profile (limiting traffic to just the external) and then compare the two accounts.