Bit of a mouthful I know – but I spent hours trying to find this on the net, with little luck. So I thought I would write a comprehensive article on how to solve this problem. This article explains the process of setting up funnels for multiple conversion paths over different subdomains using regular expressions. It assumes you are already using funnels and are familiar with the basics of Google Analytics. If you are looking for a basic guide to setting up funnels, try here, if you are already familiar with basic funnel setups then read on!
What are funnels?
Funnels are a great way to visualize your visitors’ paths through your site, with the aim of completing a particular goal. Using funnels can help you identify usability problems in your site that need to be addressed in order to increase click through rates and ultimately conversion rates.
How to create a funnel across different subdomains
mypointyhat.com wants to track visitors who land on a forum post at forums.mypointyhat.com and end up buying a pointy hat from www.mypointyhat.com/shop they then want to look at the funnel visualization for this particular behaviour.
Setting up cross subdomain tracking correctly
Before creating a funnel across different subdomains you need to ensure that you have setup the tracking on the site correctly. Firstly you need to check that the Google Analytics script is the same code on each sub domain with addition of a piece of code:
pageTracker._setDomainName(“.mypointhat.com”); (for example)
Once you have setup the tracking you need to setup an advanced filter, otherwise forums.mypointyhat.com/index.php and www.mypointyhat.com/index.php would both be treated as /index.php. To do this you setup an advanced filter and use the data shown in the following image:
Once these two things are done your pages will appear with their subdomain attached:
e.g. forums.mypointyhat.com/index.php and www.mypointhat.com/index.php instead of /index.php
If you need further instructions Google talks you through it here
How to create a funnel that works across subdomains using regular expressions
I’m guessing you have a funnel in mind, but for this one we are going to use the example I mentioned above. So essentially we want to track the funnel from forums.mypointyhat.com/thread/post-title through to www.mypointhat.com/shop/confirmation.php.
Regular Expression Matching
If you are not familiar with regular expressions, I suggest you do a Google search and do some background reading – once you understand regular expressions it gives you a whole new World of options to consider when trying to solve complex problems and arduous tasks.
The first point I will make is that in regular expressions a . (period) represents a character, therefore to get a . (period) to actually represent a . (period) you have to escape it before hand (so the program understands that it is a literal reference) the syntax for this is a backslash:
Also please note, I haven’t tested my regular expressions in the example below, so they may not work – so no copying!!!
Bearing those points in mind our steps will look like the following:
The first part to setting up the goal involves activating the goal, setting the match type as regular expression, choosing the goal and the goal name (see image below for an example)
Step 1: forums.mypointyhat.com/thread/[A-Za-z-]+ Forum Thread (Required Step should be checked)
Step 2: www.mypointyhat.com/shop/index.php Homepage
Step 3: www.mypointyhat.com/shop/products/[A-Za-z-]+.php Product Page
Step 4: www.mypointyhat.com/shop/basket.php Basket Page
Step 5: www.mypointyhat.com/shop/checkout.php Checkout Page
Step 6: www.mypointyhat.com/shop/payment.php Payment Page
Goal: www.mypointyhat.com/shop/confirmation.php Confirmation Page
Don’t forget to escape your periods!!! See the example below for a better illustration of where these URL’s go:
Now give it a day, if it doesn’t work you can check your funnel analysis and see where the problem is occuring. If you are still having problems check Google – if you STILL have problems – ask me on Twitter and I’ll do my best to help you 🙂
I must also give credit to Mr Mcskelly, who setup the cross subdomain tracking before I had to tackle the funnels on one of our client’s sites.