The skills we teach deliver real ROI.

Using the “Pipe” Symbol in Regular Expressions

When I train people on Regular Expressions, or RegEx, in Google Analytics, their eyes begin to glaze over.  It is not necessarily straightforward so I encourage people to become familiar with the use of one symbol at a time and to remember there are lots of cheat sheets available online.  Google’s support files describe how to use each character and you can test it out with with Cheatgraphy’s Regular Expressions Cheat Sheet to see if it will work in analytics.

The pipe character (|) is found right below the backspace on a PC keyboard and is used as an “or” function, meaning you want Google to display a or b.  It especially comes in handy if the naming conventions used in your Event Tracking were not set up consistently.  RegEx essentially lets you temporarily exclude data or combine it for reporting purposes without making any permanent changes in your analytics account.

Event Tracking is a way to report on user interaction with a site, such as playing a video.  Often times, there are multiple people determining how Event Tracking is set up so the naming convention is not always consistent throughout the analytics account.  For example I’ve seen accounts where they have a category of Videos and a category of videos with their events.  We look at that and easily recognize that Videos and videos are the same thing.  However, Google Analytics will report that as two different categories.  If you have a situation like this and want to view both of those categories together, you can do so with the pipe character as seen below.

ARN1

This is a simple example, but what happens is that you now see the data for both of those categories.  If you didn’t combine them, you would look at your data for Videos, then for videos in two separate steps which is extra work.

Viewing two lines of data really isn’t a huge deal, so suppose you have even more variations  of videos like the below.

ARN2

Hopefully, you won’t have that many variations for the words videos, but you can see how this is helpful if you are in a situation like that.

Another situation where you might use the pipe character in a RegEx statement is if you have two categories that were intentionally named different when you set up Event Tracking, but strategically you now see them as the same thing.  In this case, you have a category called Articles and one called Posts.  When you started out with your site, you envisioned articles and posts as being very different.  Maybe a post was 200 words and an article was 1,000 words.  Or maybe a post was a quick tidbit and an article was a more informational piece.  As you built out the content on your site, you discovered that these were really serving the same purpose.  The below screen shows the RegEx to combine the Articles category and the Posts category.

ARN3

You are temporarily combining this data so you can view those two piece of content together at a glance with whatever metrics are important to you.  Maybe you want to view number of visitors or the sources for your Articles and Posts at the same time.

For this example, it may still make sense to have Articles and Posts defined as two very separate pieces of content because you do view them as very different from one another.  The pipe character in RegEx gives you a way to look at this information on the fly if you want to view these two categories together at a moment in time.

The pipe character also helpful for including or excluding specific pieces of information.  With videos, there are a number of actions a user can perform: play, back, pause, stop, and forward are some commonly used Event Actions.  If you want to temporarily exclude specific actions, such as pause and back, you can choose to “Exclude” the event action that matches the RegEx of Pause|Back as seen below.

ARN4

That lets you view your report for all actions except for pause and back.  It could also be reversed where you include only those actions.

We looked at the pipe character for combining or excluding different types of data and hopefully these examples gave you some suggestions for changing how you view your data in analytics.  Remember, this is a very useful tool to look at or remove a piece of data without making a permanent change that can happen with filters.  The Google support article referenced above includes other characters you can use in Regularly Expression but I encourage you to start with “|” and get comfortable with it before trying out some of the others.

 

Leave a reply

css.php