Jul 21, 2009

Filters Allow You to Limit Google Analytics Data to a Subdirectory

thm-wp-pluginIf your site came before your blog, you probably installed WordPress into a subdirectory like we did at http://www.MailChimp.com/blog.

When you log into WordPress and look at the dashboard for your awesomely new WordPress Analytics Plugin, you’re probably wondering how you can limit the data to only your blog traffic.

Here’s how we did it at MailChimp…

First you’ll need to log in to Google Analytics and find your site in the "Website Profiles" list.

1. Adding a New Profile

Then, click +Add New Profile next to the web site that has your blog attached to it.

Add a New Profile to Google Analytics Account

Add a New Profile to Google Analytics Account

You’ll arrive at the Create New Website Profile page. Make sure you select Add a Profile for an existing domain. Then check to make sure your main web site is selected in the "Select Domain" box.

Create a New Profile

Create a New Profile

Give your new profile a meaningful name. How about "Name of Your Site Blog"? Click "Continue" to save the profile and let’s see how the magic filtering happens.

2. Create a Filter for Your New Blog Profile

Now that your new blog profile is created it’s recording the same exact data as your web site. Don’t worry! We can filter the current data to only include your blog (aka "The Magic").

Find and click the Edit link for the new profile you created.

This page contains all of the settings for your new profile, but we’re only interested in one area: Filters. Look for the Filters Applied to Profile section and click +Add Filter.

Profile Settings Page

Profile Settings Page

Make sure Add New Filter for Profile is selected and give the filter a descriptive name, like "Blog Traffic."

The filter type you want to select is labeled "Include only traffic to a subdirectory"  and you’ll want to use Google’s example as a baseline for finding the subdirectory. Something like "^/blog" where "blog" is the name of your main WordPress directory.

Your new profile has been added.

Your new profile has been added.

Save your changes and head over to your WordPress Admin.

3. Use Your New Profile in Analytics360 for WordPress

After you log in to WordPress, look under the Settings menu for Analytics360 and click over to your Analytics360 settings.

Under Step 2, you’ll want to select your new profile from the "From now on track:" select box. Click "This One!" to activate your new blog profile for Analytics360.

Your Analytics360 Settings in WordPress

Your Analytics360 Settings in WordPress

What gives? There’s No Data?

It’s going to take about 3+ hours for some data to start rolling in, like when you setup Google Analytics for the very first time. It’s actually best to give it a full 24 hours, so you’ll at least get a full day’s data in your Analytics360 Dashboard.

Be patient! All is well in the world of WordPress Analytics now.