While working with various ecommerce stores I found a common problem. Many sites have decided for one reason or another to remove hierarchy from their site’s URL structure. The hierarchy structure would look something like this domain.com/categoryName/product.html. Many sites whether for SEO benefit or to make it easier to read/memorize for their visitors have removed everything after the domain and before the final forward slash. This may not seem like a big deal, but when you need accurate analytical reporting for all types of pages on your website it can become a problem. Store owners would ask me to find how many visitors are landing on our brand pages? Well… Given that there is no way to distinguish between types of pages I would have to look up each page manually. Depending on the size of the store this could take hours. This particular store had over 200K worth of pages. With their current configuration they cannot answer simple questions like “What is my bounce rate for category pages?” or “What type of page brings the most traffic?” In this post I am going to direct my example towards ecommerce sites, however the principle can be applied to any type of website.
As an example I will use www.vitalitymedical.com. For 95% of the site you will notice that the depth of the URL is only one deep. Let me show you a few examples:
- Brand Page: http://www.vitalitymedical.com/encore.html
- Sub Brand Page: http://www.vitalitymedical.com/dover.html
- Category Page: http://www.vitalitymedical.com/impotence.html
- Sub Category Page: http://www.vitalitymedical.com/lubricant-1.html
- Product Page: http://www.vitalitymedical.com/impo-aid-battery-relpacement-head.html
- Brand Category Page: http://www.vitalitymedical.com/encore-impotence.html
Using Google Analytics it would be very difficult to find the bounce rate, exit rate, page value, visits, or landing visitors. It is very important to know these metrics and others when determining site structure, value of page types, errors on your store, or directing PPC traffic.
Fortunately, there are a few ways around this. I am going to address one of those ways as I find it to be the easiest and most helpful solution. Google uses a tracking code on each page of your website. If you look at the source code for your page you should see something like the code below. Yours may look slightly different depending on the type of tracking you are doing.
var _gaq = _gaq || ;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script'); s.parentNode.insertBefore(ga, s);
Locate this line in the tracking code “_gaq.push(['_trackPageview']);”. This is the location where the current URL is sent to google. Well with a small change we can now tell Google to record “/encore.html” as “/Brand/encore.html” by changing “_gaq.push(['_trackPageview']);” to “_gaq.push(['_trackPageview', '/Brand/encore.html']);” . On stores with thousands of pages you would want to add a page detection to automatically insert the page type into the code above. After an hour or so you should be able to see your new URLs in Google Analytics with an easy identifier and saved yourself hours of work!