How To Aggregate Traffic Sources in Google Analytics

James Standen Analytics Canvas Tool, Google Analytics Data Leave a Comment

If you have to do reporting of your website traffic sources, you’ll notice that the raw data from Google Analytics is often somewhat, well, raw.

For example, you might want to report how many visitors came to your website via Twitter- but google analytics will have multiple sources for this- “twitter.com”, “mobile.twitter.com”, as well as other clients- “twittergadget.com” or “hootsuite.com”. You know that these are all twitter- but in the raw data, they are multiple groups.

Analytics Canvas provides easy to use, and very powerful tools to tame this raw data all in one place.

traffic sources in Google Analytics
Don’t make the mistake of ignoring the long tail and focusing only on the “main” traffic sources. Just because Google Analytics doesn’t group things together doesn’t mean there isn’t a big group in there.

Making Simple Rules to Group Traffic Sources in Meaningful Categories

Our goal for this blog post is to show how we can define simple rules that will categorize all our visits into a smaller number of meaningful categories.

If we can do this, we’ll be able to see where our traffic is coming from- and trends in time, that we just can’t see in the raw data as first presented.

Getting Traffic Source Data from Google Analytics

In Analytics Canvas you go to the “Add data” toolbar menu, then select Google Analytics, and pick which of the profiles (or multiple profiles if you like) you want to do the analysis on.

You will then be able to select the dimensions and metrics to be included- for this example we’ll use the following:

  • Dimensions: Date, Source, Medium, Referral Path
  • Metrics: Visits, Bounces, Goal1completions


If you want to analyze a different goal, or multiple goals, then just include those too.

After you pick all those dimensions and metrics, Analytics Canvas will create a block on the canvas, that holds the raw data extracted from Google Analytics. We are going to add a segmentation block to the canvas and connect it to the output- as you can see to the right.

Now, what we want to do is organize this data into more meaninful groups by defining the rules for that segmentation block.

Selecting Meaningful Groups for Visits

Actually deciding what categories you want is the key- I’ll show some examples of groups that I find useful- but this is bound to vary depending on who you are, what your website does, and specific types of traffic sources / referrals etc. that you see.

When we use a segmentation block, we define rules using excel like expressions, and Analytics Canvas checks each incoming raw data row with the rules in order, and the first rule that returns TRUE defines the group that that row will be in. If none of our rules results in true, we have default, fall through category (very often called “Other”). The goal is to make a series of rules that group all the visits in a meaningful way.

First, I’ll define some rules that will organize the organic search. I like to see Google, Google Image, Bing, Yahoo and “Other Search”.

So the rule for Google Search is :

AND ( [Original.medium]=”organic” , [Original.source]=”google” )

After this rule, I create a series of rules, some are easy- but one right away is an interesting one.

For some reason, when google sends image search visits, they get marked as referrals, not organic- and the referral path is set to “/imgres”. This can be frustrating in Google Analytics, as it means that using standard reports will not include this search traffic. There is also in my experience from time to time traffic from “images.google.com”

We can simply make a rule that detects this traffic, and calls it Google Image Search;

OR ( AND ([Original.medium]=”referral”,[Original.referralPath]=”/imgres”) , [Original.source]=”images.google” )

But we are not limited to simple operators within a segmentation block (or all blocks in Analytics Canvas)- we can use more complex functions, and even Regular expressions if we want to define what we need.

For example, notice the rule that uses the Contains function to resolve the Twitter duplicates we discussed earlier.

So the final ruleset I have built looks like this:

And you can use the Analytics Canvas data profiler to take a look at how many rows got set to each group:

These are meaningful categories, that you had complete control over defining- and can edit if the data requires it, for example if new data sources arise that you want to track, you simply have to add a rule, and put it in the appropriate order location.

Another advantage of this approach is that you can now save the segmentation block definition you created to a file, and reuse it- even share it with others on your team also using Analytics Canvas. You can use different segmentations for different profiles, or different types of Analysis.

Check out what else you can do with Analytics Canvas by watching some of our Tutorial videos– or better yet, download the free trial and try it with your own data.

Leave a Reply

Your email address will not be published. Required fields are marked *