Have you ever wanted to create a report in Google Analytics that only contained certain dimensions? For example, have you ever wanted to see metrics specific to two referral sources for a given time period, without having to export into Excel and sort? Today’s blog post is all about learning how to customize a report within the new Google Analytics platform by using the pipe symbol to create a regular expression.
To get started, log-in to your Google Analytics account and navigate to Standard Reporting (see figure below):
We navigated to Traffic Sources > Sources > Referrals, but feel free to choose your desired report. Any report that has an advanced sort option (see the blue “advanced” link in the top right of the below figure) has the same procedural steps as this example.
1. Select Advanced Sort
Click “advanced” above the data that displays in your desired report. The screens should expand (see figure below):
2. Select Dimension
If you would like to change the dimension, now is the time. For this example, we would like to keep the default as Source.
3. Select Matching RegExp
From the Containing dropdown menu, select “Matching RegExp.”
4. Write Your RegEx
This report shows a number of different referral sources. For this example, let us assume we were asked to generate a report that contained only referral traffic from LinkedIn and Twitter, so logically; we would want the report to contain LinkedIn traffic OR Twitter traffic. Translating this to a regular expression would yield:
Then click the Apply button.
In the following figure we show that this is not case sensitive:
It should be noted that a more complex Regular Expression would need to be written to exclude variations or subdomains appearing in the report (in this example, mobile.twitter.com), if desired.
For a list of the most commonly used Regular Expression symbols and a number of regular expression examples, please read our blog post entitled “Regular Expression Examples for Google Analytics.”