Google Analytics custom filters to tidy up your metrics: how to split up social media from referrals

Google Analytics filter social media channels

Note: The Google URL Builder has been updated; therefore, I advice to have a look to this interesting guide written by Prateek Agarwal.


This post is about adding a custom filter to refine your Medium report on Google Analytics.

I am not going to talk about the “direct / none” aggregate that unfortunately include also visits that are not direct accesses like a user typing your URL or a bookmark, but any other session missing server data information. There is a wide literature about, but the problem remains unsolved.

Let’s talk about another medium category, referrals, that also includes visits coming from social media. Why not taking social media visits away from referrals?

Custom filters are a very useful tool for aggregating or adjusting some metrics before they appear on reports. In this post I’ll show you how to use custom filters to assign all visits coming from social media sources to a Medium category called “social“. Just follow this step:

GA Event Tracking on Google Tag Manager

The source for visits from FB mobile is “m.facebook.com” whilst Twitter is “t.co”. You can add all social media together by using Regular Expressions (RegEx). In this case you might need to do some testing. A RegEx for social filter can be this one:

(facebook.com|m.facebook.com|facebook|vk|vk.com|t.co|twitter|hootsuite|tweetdeck|plus.url.google.com|youtube|linkedin|reddit|digg|delicious|stumbleupon|myspace|flickr|popurls|friendfeed)

Remember to add also “field b = referral” because you don’t want to tas as social whatever is tagged not referral, for example a CPC campaign run through Facebook or LinkedIn.

After applying the filter don’t be impatient with Real-Time stats as custom filters might take a short while to apply properly.

A suggestion to speed up your RegEx learning process is to create a test profile (never play with the main profile!) and apply different filters there, assigning categories called social1, social2, etc. for different RegEx’s so you will reckon which is working and which is not by looking at the variable appearing on reports few hours after applying the filters.

Let’s go back to my proposals. Here’re the filters applied taken:

  1. visits from social media whose source is “facebook”, “twitter” or “google plus” have been all automatically categorised as “referrals” and will now be categorised as “social”
  2. using another custom filter, all medium assigned to “rss” will be renamed “feed” in order to join another existing category:  there is no need to have two different categories of the same type (distinction will be still available under Sources)

Here is what I had before (15/05/2013)

Filter to separate social sources from referral on GA

and this is what I had after applying the filter (19/05/2013)

…after the filter

Observations:

  • visits from social media are taken off from “referral” and placed into a new category called “social” that will also include all future social media activity tagged through the URL builder to be taken away from the “(none)”
  • RSS disappear and joins “feed” for more clarity
  • the site does not have benefit of any paid advertising source
  • direct/none stable (14% / 15%)
  • organic stable (11%)

Filters above apply only to Campaign Medium, but what about organising also Sources by aggregating at least the most relevant URL’s under just few categories? For example you can join www.facebook.com and m.facebook.com under just “facebook”.

Again, to be precise, you can use RegEx but mind that if you select all domains that contain the word “facebook” or “twitter” you might end up in adding sites that are not facebook and still link to you. For example think of the service “twitterfeed” which is not Twitter. My suggestion here is to narrow aggregation just to the most relevant categories: if you’re embracing let’s say 95% of your visits that could be enough, isn’t it?

A further action: tag your incoming links with the URL builder whenever possible

If you want to reduce the amount of “(none)” among your media, start tagging all your social media posting that links to your website using the URL builder. In this case, I suggest to keep “social” as Campaign Medium for non paid (e.g. a Tweet or a Facebook post on wall or tab) and “cpc” or “paid” for paid (e.g. Facebook advertising) aligning it to other paid sources if any (e.g. AdWords).

You can use URL shorteners, but be sure that they keep tags or your link end up in the meaningless “direct/none” category. To manage non-paid incoming links from your own social sources Lunametrics has built a simple but still useful Google spreadsheet, using the shortener bit.ly

Be consistent with tags

If many people have access to your social media stream and run digital campaigns you should do some efforts to align tagging policies otherwise you might end up in a mess on GA reports. I’ve seen reports including many similar tags all together such as CPC, cpc, PPC, paid, ads, advertising, social, socialmedia, facebook, fb, etc.

Why separating social from referrals?

Ok they are all referrals, but usually visits coming from social media come from piece of content that links to your website (e.g. a post on Facebook wall). I say ‘usually’ because such links might be also placed on social media areas such as notes, tabs, twitter profile description, about sections, etc. together with other links, but such places are less relevant than the mainstream. Other referrals (traditional, let’s say), most of the times are link placed on websites (e.g. blogs), either because they like you/find your content relevant/worth mentioning or because of your link building activity. I’m not debating whether it’s better to have “social signals” or referrals from a pure SEO perspective during the Penguin era. Let’s say that it’s important to be noticed both by search engines and (yes, apparently we’re still humans) real people, but this post helps you to distinguish among digital type of  place where you’ve been spotted on: making a parallel with geography, if the source is the name of the place, the medium is the type of place.

A filter also for email

Usually newsletters/DEM are tagged with “email” medium. Why not doing the same with a custom filter that attributes “email” medium to all sources that contain the word “mail”? It can be mail.yahoo.com, gmail.com, etc. You might also add other relevant email providers like outlook, hotmail, etc. with a RegEx like (mail|outlook|hotmail|etc….). Again, if you want to preserve other medium like cpc, add a field b=referral – this way you will be pretty sure that all links to your site placed on email content will be tagged with “email” medium instead of referral.

Remember: it’s never too late to tidy your reports and to adopt a consistent and constant “tagging policy”.

 

4 replies
  1. Jessica says:

    Can I use filters to assign a source/medium to a “direct” link? I have a wix site and I’m having trouble using campaigns (they don’t work) so I’m trying some work arounds of my own.
    Thanks!!

    • Paolo Margari says:

      Hi Jessica, you can overwrite source/medium but if the information is hidden by your platform all data will be lost. It’s interesting to find out why you cannot get bring campaign parameters to GA, maybe you have some redirect in place?

      • Jessica says:

        I think there are alot of features that I’m finding don’t work with Wix and GA. Like it wouldn’t a page address when I was trying to create a campaign for my subscribe page, so I could track some of the places people click from. I’ve really only just starting researching these things last night but I instead added /#sub_sa to my links which I can view as a landing page but then i don’t have an source/medium data

  2. Paolo Margari says:

    Hi Jessica, you can overwrite source/medium but if the information is hidden by your platform all data will be lost. It’s interesting to find out why you cannot get bring campaign parameters to GA, maybe there’s some redirect in place?

Comments are closed.