For many web traffic analysts, most would have some great skills in analysing and crunching numbers and data, generating pretty graphs and reports, as well as some marketing insights on how to take action. However one skill that might have been so prevalent is the ability to generate Regular Expressions (or regexs as they are known in the developer world). In fact, many first time programmers struggle with generating them properly.
With Google’s goal conversion and filtering now all being able to accept regexs all over the place, it is a skill all analytics people should have up their sleave, rather than running to the dev team.
So What Exactly are Regular Expressions
I cannot say it much better than this:
A way of describing a pattern in text - for example, “all the words that begin with the letter A” or “every 10-digit phone number” or even “Every sentence with two commas in it, and no capital letter Q”. Regular expressions are useful in Apache because they let you apply certain attributes against collections of files or resources in very flexible ways - for example, all .gif and .jpg files under any “images” directory could be written as “/images/.*(jpg|gif)$”. Apache uses Perl Compatible Regular Expressions provided by the PCRE library. - Apache Glossary
Where Can I Learn About Regex?
There are plenty of places online that provide regular expression tutorials and how to implement them into your code. However, we do not need to implement them into PHP or JavaScript, we just need them to filter data in big analytics reports.
Google has recognised this and as part of becoming an Analytics Qualified Individual, there is an entire section of the conversion university regarding the topic. Visit the Google Analytics Regex Lesson and see exactly their application in your context.
Any Regex Builders out there?
Why of course there are! Here are just a couple:
- TrakkBoard - You can run this little app as a desktop version that has filtering already built in for a couple of small areas.
- RegExr - This is an app that lets you build, test and store regular expressions which you can cut and paste across into Analytics
So in conclusion, this might be the most painful part of the job (definitely the less sexy) but there so much awesomeness that comes out of nailing a regex just right (it’s better than crossing items off a to-do list).
But Wait - Don’t Get Greedy
Specifically relating to Google Analytics, Regular Expressions, and Goal Conversion tracking - there is one problem that always creeps up on the new guys.
You will discover that .* catches absolutely everything and you think it is a nice and easy default way to make sure everything is included and all goals track in one nice tiny expression. What you don’t realise is that by default regular expressions are greedy, and when you tell it everything, it does include everything. So resist the urge to take the easy way out. For example:
- If you know that there is only going to be numbers in the URL, use
[0-9].
Have fun!
{ 3 trackbacks }
{ 0 comments… add one now }