{"id":2517,"date":"2009-07-21T16:13:35","date_gmt":"2009-07-21T15:13:35","guid":{"rendered":"http:\/\/www.davidnaylor.co.uk\/?p=2517"},"modified":"2023-02-28T14:50:05","modified_gmt":"2023-02-28T14:50:05","slug":"google-analytics-goal-conversion-funnels-across-subdomains-with-regular-expressions","status":"publish","type":"post","link":"https:\/\/www.bronco.co.uk\/our-ideas\/google-analytics-goal-conversion-funnels-across-subdomains-with-regular-expressions\/","title":{"rendered":"Google Analytics goal conversion funnels across subdomains with regular expressions"},"content":{"rendered":"<p>Bit of a mouthful I know &#8211; but I spent hours trying to find this on the net, with little luck.\u00a0 So I thought I would write a comprehensive article on how to solve this problem.\u00a0 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, <a href=\"http:\/\/www.google.com\/support\/googleanalytics\/bin\/answer.py?hl=en&amp;answer=55515\">try here<\/a>, if you are already familiar with basic funnel setups then read on!<\/p>\n<h2>What are funnels?<\/h2>\n<p>Funnels are a great way to visualize your visitors&#8217; 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.<\/p>\n<h2>How to create a funnel across different subdomains<\/h2>\n<h3>Example<\/h3>\n<p>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.<\/p>\n<h3>Setting up cross subdomain tracking correctly<\/h3>\n<p>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:<\/p>\n<p>pageTracker._setDomainName(&#8220;.mypointhat.com&#8221;); <em>(for example)<\/em><\/p>\n<p>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:<\/p>\n<div id=\"attachment_2519\" style=\"width: 310px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2519\" class=\"size-medium wp-image-2519\" title=\"Advanced Filter for Sub Domains\" src=\"\/our-ideas\/wp-content\/uploads\/2009\/07\/advanced-domain-filter-300x247.jpg\" alt=\"Advanced Filter for Sub Domains\" width=\"300\" height=\"247\" \/><p id=\"caption-attachment-2519\" class=\"wp-caption-text\">Advanced Filter for Sub Domains<\/p><\/div>\n<p>Once these two things are done your pages will appear with their subdomain attached:<\/p>\n<p>e.g. forums.mypointyhat.com\/index.php and www.mypointhat.com\/index.php instead of \/index.php<\/p>\n<p>If you need further instructions Google talks you through it <a href=\"http:\/\/adwords.google.com\/support\/bin\/answer.py?hl=en&amp;answer=55524\">here<\/a><\/p>\n<h2>How to create a funnel that works across subdomains using regular expressions<\/h2>\n<p>I&#8217;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.<\/p>\n<h3>Regular Expression Matching<\/h3>\n<p>If you are not familiar with regular expressions, I suggest you do a Google search and do some background reading &#8211; 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.<\/p>\n<p>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:<\/p>\n<p>e.g. .<\/p>\n<p>Also please note, I haven&#8217;t tested my regular expressions in the example below, so they may not work &#8211; so no copying!!!<\/p>\n<p>Bearing those points in mind our steps will look like the following:<\/p>\n<p>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)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2521\" title=\"goal-settings-a\" src=\"\/our-ideas\/wp-content\/uploads\/2009\/07\/goal-settings-a-300x136.jpg\" alt=\"goal-settings-a\" width=\"300\" height=\"136\" \/><\/p>\n<p>Step 1: forums.mypointyhat.com\/thread\/[A-Za-z-]+ Forum Thread (Required Step should be checked)<br \/>\nStep 2: www.mypointyhat.com\/shop\/index.php Homepage<br \/>\nStep 3: www.mypointyhat.com\/shop\/products\/[A-Za-z-]+.php Product Page<br \/>\nStep 4: www.mypointyhat.com\/shop\/basket.php Basket Page<br \/>\nStep 5: www.mypointyhat.com\/shop\/checkout.php Checkout Page<br \/>\nStep 6: www.mypointyhat.com\/shop\/payment.php Payment Page<br \/>\nGoal: www.mypointyhat.com\/shop\/confirmation.php Confirmation Page<\/p>\n<p>Don&#8217;t forget to escape your periods!!! See the example below for a better illustration of where these URL&#8217;s go:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2522\" title=\"goal-settings-b\" src=\"\/our-ideas\/wp-content\/uploads\/2009\/07\/goal-settings-b-300x281.jpg\" alt=\"goal-settings-b\" width=\"300\" height=\"281\" \/><\/p>\n<p>Now give it a day, if it doesn&#8217;t work you can check your funnel analysis and see where the problem is occuring. If you are still having problems check Google &#8211; if you STILL have problems &#8211; <a href=\"http:\/\/m.twitter.com\/davewhitehouse\">ask me on Twitter<\/a> and I&#8217;ll do my best to help you \ud83d\ude42<\/p>\n<p>I must also give credit to <a href=\"http:\/\/www.mcskelly.com\/\">Mr Mcskelly<\/a>, who setup the cross subdomain tracking before I had to tackle the funnels on one of our client&#8217;s sites.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bit of a mouthful I know &#8211; but I spent hours trying to find this on the net, with little luck.\u00a0 So I thought I would write a comprehensive article on how to solve this problem.\u00a0 This article explains the process of setting up funnels for multiple conversion paths over different subdomains using regular expressions. [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4],"class_list":["post-2517","post","type-post","status-publish","format-standard","hentry","category-search-engine-optimisation"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bronco.co.uk\/our-ideas\/wp-json\/wp\/v2\/posts\/2517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bronco.co.uk\/our-ideas\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bronco.co.uk\/our-ideas\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bronco.co.uk\/our-ideas\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bronco.co.uk\/our-ideas\/wp-json\/wp\/v2\/comments?post=2517"}],"version-history":[{"count":0,"href":"https:\/\/www.bronco.co.uk\/our-ideas\/wp-json\/wp\/v2\/posts\/2517\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bronco.co.uk\/our-ideas\/wp-json\/wp\/v2\/media?parent=2517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bronco.co.uk\/our-ideas\/wp-json\/wp\/v2\/categories?post=2517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}