Custom Filters For GA, Part 4b: Custom Advanced

May 20, 2007

Custom advanced filters can be very cool. You can use them to rewrite stuff. And much cooler, you can use them to associate stuff.

For example, you can use an advanced filter to associate a Request URI (a page someone asked for) with a Campaign Medium (the medium they used to get to your site) and then dump it all back into Request URI (so that you can see it in your Content > Top Content report.) Before I go into the technical details, you may be saying, why would I ever want to do that? Well, if you have 10,000 URIs and you want to look at them all in Excel, it would be nice to have a report that you can download into a csv file and then sort any way you like.

So here is a screenshot of what that filter would look like. (Ooh, many thanks to Steve and to our web designer, both of whom gave me the same advice on better screen shots. So now this one is legible:)

advanced-filter.gif


Notice the A and B stuff in the middle. Here is what I am telling Google:

My field A is Request URI. Get everything, by using .* and put it in a variable, by using parens, so get-everything-and-put-it-in-a-variable looks like (.*)

My field B is Campaign Medium. Once again, get everything and put it in a variable, hence (.*)

Now comes the magic. Output it all to Request URI. And format it so that I see the A variable (that’s why I used $A1) and then a colon, and then the B variable. That last field, constructor, is not a regular expression. You can write anything you want there — I could have written $A1/$B1, or I could have written, $A1 AND $B1, etc. Also note: in the A field, there is only one variable, (.*), so I used $A1. Same for B. But there might be two variables, and then I would use $A1, or $A2, etc.

Choosing where to output your new mashed up string is important. For example, if you want to see, how many people came through a banner ad medium, touched the home page, and then converted, you wouldn’t want to use the filter I just created — even though it creates the correct information, a mashup of the medium they came in on with the page they touched. That’s became this particular example gets output to content >top content, a report that doesn’t include conversion. A better place to output it to would be campaign name. That way, it will get dumped into your campaign report, which has conversion associated with it.

If you are doing this kind of mashup, it is vital to create a new profile first. After all, you probably need most of the reports “unmashed” for some things, and if you do this in a separate profile, you can mess around all you want, while leaving your production data untouched. Need to learn more about creating new profiles?

Endnotes: Many thanks to Caleb Whitmore from POP, who taught me so much about custom advanced filters when we were at Google training. Caleb actually wrote this particular filter a few months ago. And to Dylan Lewis, for getting our new address right, www.lunametrics.com/blog and for letting his web analyst, Joy Billings, be co-chair of the WAA marketing committee. I have really awesome pictures of both Caleb and Dylan.