Hey there!
I'm Benjamin from Loves Data.
In this video you'll learn the top 5 Regular Expression tips you can use with Google Analytics.
If you're not familiar with Regular Expressions, also known as RegEx, they allow you to do
more advanced matching with the data in your reports.
You can use them when creating segments, building custom reports, applying filters to your reporting
views and more.
By using these top 5 Regular Expression tips you'll be rocking Google Analytics in no time!
And Regular Expressions aren't just limited to Google Analytics, there are a whole range
of other applications too.
Let's jump in and cover the top 5 Regular Expression tips for Google Analytics!
Tip number 1 is - to use the 'or' statement.
This is a powerful way to immediately speed up the way you use Google Analytics.
For example, we can use a table filter like this one in the 'all pages' report to just
focus on a selection of important pages.
However, we can speed things up by using a Regular Expression that includes an 'or' statement...
Here's the same example, but this time we're using a Regular Expressions with pipes to
say we want to match the first, the second or the third page.
You can also extend this to include additional pages by adding another pipe and then including
another page.
You can also apply this technique anytime you need to match multiple values in Google
Analytics, from multiple acquisition sources, keywords, geographic locations, anything at
all.
And if you're wondering where to find the pipe symbol it's typically located with the
backslash key on your keyboard.
Tip number 2 is - where we match everything in our Regular Expression.
This might sound strange, but it's a quick and flexible way of matching elements where
we don't know all of the possible values (or we don't want to include all of them in our
expression).
To match everything we use a full stop (which says 'match any single character') immediately
followed by an asterisks (which says 'match zero or more times').
When we combine the full stop and the asterisks this is saying 'match zero or more of any
character', so match everything.
Let's say we're using the all pages report again, but this time we just want to see blog
posts that relate to the topic of 'analytics'.
I can use the table filter to search for... forward slash, blog, forward slash, then full
stop, asterisk, and then analytics.
This allows me to find any page from my blog that also includes 'analytics' in the page
path.
Tip number 3 is - to match things at the beginning.
For example, if we are using the Search Console reports in Google Analytics and we want to
see all of the search queries that begin with our brand name, we can use this regular expression...
The caret symbol says that there can't be anything before our expression.
It must be at the beginning.
So for our example we're saying that 'loves' must be at the start of the search query.
There can't be anything before 'loves', so this would match 'loves' and also 'loves'
with any additional characters following it.
This is also useful for matching particular pages and even particular folders in your
reports.
Here's another example...
In this case the regular expression will match all pages in our report that begins with forward
slash blog.
Tip number 4 is - to match thing to the end.
Let's say that we want to configure a goal in Google Analytics that tracks a conversion
for every page that ends in 'thank you'.
We can quickly achieve this using a Regular Expression.
Here's what our goal configuration would look like...
You'll notice that we've selected 'regular expression' as the match type for the goal
and then we've entered...
thank dash you followed by the dollar sign.
This means that the expression will only match strings ending in thank you.
It won't match any pages where there are additional characters after thank you.
Tip number 5 is - using brackets to make a list of items to match.
This is similar to the first tip, but can be used in the middle of an expression.
For example, let's say we want to match these pages on our website.
We want to match forward slash contact, dash news, forward slash thank you AND we want
to match forward slash, dash lead, forward slash thank you.
We can do this with the following regular expression...
This is creating a list of items, in our case 'news' or 'lead'.
And a bonus tip for you is that you can also use brackets to store a variable if you're
filtering views in Google Analytics.
So they're the top 5 Regular Expression tips for Google Analytics.
If you are new to Google Analytics, then don't worry if they're a bit confusing at first.
They are more advanced, so you'll need to spend a little bit of time learning about
them and playing with them inside Google Analytics.
But they will help speed up the way you use Google Analytics and give you even more flexibility
in the way you analyze and report on the performance of your website and marketing campaigns.
Remember that you can use Regular Expressions for a range of different needs.
You can use them when filtering data in your reports, creating segments, building custom
reports, configuring content groups, creating filters and more.
So what's stopping you?
Jump into your reports and start playing with Regular Expressions - you'll be rocking Google
Analytics!
Do you have any tips you'd like to add?
Let me know in the comments below!
And if you found this video helpful, then please like it, so I know to make more videos
like this.
See you next time!