Following my Google Analytics Unravelled blog about searching and filtering Analytics the other week, I thought I’d write a quick note about using regex is probably needed to finalise this blog. Regex (or regular expression) can be used to make sure you are getting the information when performing a search. I’ve mentioned Regex before on the Vertical Leap blog, probably because I like it a lot. But Regex is really helpful for enabling you to do things in Google Analytics.
From the drop down list select Regex and you can then enter a phrase or term to ensure you get everything you want. Here are some examples:
The Carat symbol ^ at the beginning of a term means begins with – for example entering ^Widget which would bring back keywords which BEGIN with Widget and not “Blue Widget” as this doesn’t being with Widget but “Widget Accessories” would appear as this does begin with Widget
The Dollar symbol $ at the end of a term means ends with – for example entering Widget$ which would bring back keywords which END with Widget so this would return “Blue Widget” as this ends with Widget. However this would not bring up “Widget Accessories” as this doesn’t end in Widget.
You can use both of these regex symbols at the same time, so if you only want to see an exact match term such as “widget” and no variations of this, then search in the advanced search box like this: ^widget$ and only the term Widget will be displayed.
Both the Carat and the Dollar are called Anchors in regex as they “anchor” the search around either the beginning or the end word entered.
Another really useful tool if you are looking for keywords and you know of a particular misspelling you want to account for in your results, for example if people often misspell lightning with an extra E (lightening) you can use a ? to say that the character before may or may not occur – for you would enter lighte?ning in the search box. This would return both Lightning and Lightening in the results.
The Pipe | acts as an OR command so you can search for a number of things at the same time – for example the below:
Will bring back information only on the exact match terms “widget” and “gadgets”, saving you a bit of time on searching for both.
One note on using the pipe is to make sure not to add a | to the end of your query as this will bring back “everything else” so.
Will bring back exact match traffic for “widget” and “gadget” BUT will also return everything else, leaving you with the same data you had before performing the query. So don’t get carried away with the Pipe symbol, or your reports and queries won’t make any sense.
In the main Advanced Search boxes dotted across Analytics you can use Regex but you do need to be aware that there is a character limit of 255 characters in this box. If you need to perform longer search queries (for example to see the exact match traffic on 20 keywords, or to a list of 10 pages) you can do this by using a custom report which allow you to see the same Dimensions in them. You can Filter your custom report by a Dimension so that the data your report contains only matches a specific criteria. The pipe is great for this, as it means you can limit your results to be relating to two things without having to set up multiple filters.
For example if you run PPC you could set the medium of a report to be either PPC or CPC (because this covers the two different ways PPC traffic is reflected in your analytcs) and you will see only this traffic. I’ve shown this example below
There’s a lot more to Regex than these items, I’ve just covered the core ones you are likely to use in Analytics when searching or creating custom reports. More Regex will follow in future blogs I’m sure, as I cover other items in Google Analytics such as Filters.