Analytics Attribution For A Blog Subdomain

Posted on April 6, 2013 in Technical Musings

Every time I have to answer someone as to whether I think blogs need to exist on their own subdomain, or in a subdirectory, I opt for the subdirectory. Now despite Matt Cutts talking a lot about the subject he doesn’t say a whole lot.

I’d rather have my inbound links pointing to a subdirectory on a domain I’m trying to rank instead of a subdomain. After all, if parasitic SEO were still super powerful, why don’t we see SERPs littered with BuyViaga.Wordpress.com and the like?

Regardless of how you feel about it, you may be technically limited from putting your blog in a subdirectory. One use case is if your Ruby app won’t accept a WordPress installation in a subdirectory.

The problem arises when you use /post-name with your blog and cross domain attribution with your analytics. This means that blog.yourdomain.com/post-name will show up the same as yourdomain.com/application-url in your analytics reports. This can make it difficult to attribute conversions to the blog since the page names don’t share any common characteristic. Luckily, we can fix this using Google Analtyics filters. Here’s the filter you need to make, the explanation is below:

filter

The advanced filter uses regex to reconfigure that data that goes into the analytics profile. Here, we look at Field A which looks to match any URL with blog in the hostname. That “activates” the filter, because we’re requiring this to match before anything else happens. Then the second field matches everything after the domain name. This would be the post URL. Then it finally outputs this data into the request URI. So it outputs your blog post URI with blog in front of it like so: /blog/post-name. This allows us to search for /blog to see how all our posts are performing. If we’re really interested, we can make a custom segment that looks for /blog and see our blog data in aggregate.