Regular Expressions in Google Analytics


One of the things which can sometimes be really confusing is using regular expressions in the ‘find page’ box in google analytics. Find page function in google analytics

I’d previously been put off its use by its apparent complexity. Which was a shame, because now I’m starting to get my head around this and its cool for showing content in a more sensible way.. Here’s the issue I was working on recently. We have a whole bunch of news on our website, the urls can look like this:

http://www.lu.se/o.o.i.s?id=708&news_item=3337 

or

http://www.lu.se/o.o.i.s?id=1187&news_item=3321

The identifier is the 1187 or 708 number. Seeing them separately in GA is easy enough, just plug in the 708 or 1187 number. But if I want to see all the news, I need to use a regular expression. So, if I use /o.o.i.s\?id=(.*)&news_item=(.*) in the find page function, I then get both 708 and 1187. I tested this, by adding the totals of searching separately, and then using the regular expression and they almost match – somewhere along the way I lost about 100 views but thats probably more to do with my cruder searches for 708 or 1187 picking up non news pages where these numbers occur.

Why not just use advanced segments? Good question, and while I am a huge fan of advanced segments it seems to throw out wierd results when I try segmenting by page title.  Just by looking through the results from the regular expression I can see that I’m only counting the pages I want to examine.  Having got these results, I can now add my segments (e.g visits from Lund, visits from Stockholm) and start finding out who sends us the love.

Or have I missed something blindingly obvious – let me know!