1 Comment | ADD

Since launching our business, GDD Interactive partner Bay Leaf Digital,  in March 2013, we have met and talked to many small and medium sized businesses to understand their website related needs.  We have found that almost all of them have websites with Google Analytics installed.  When asked whether they use GA for monitoring and improving their sites’ performance, the typical response has been something like ‘Not really because it doesn’t provide much insight into what I can do increase revenue/leads/traffic’.  This is clearly a huge missed opportunity.

In looking at their Google Analytics setup, the problems we found can be categorized in these broad buckets:

  1. Google Analytics is installed incorrectly
  2. Easy to leverage features such as goals, events, and custom variables are not being used
  3. The average business owner has limited knowledge about using standard and custom reports

So we have taken it upon ourselves to help these businesses learn how they can make more money by harnessing the power of web analytics.  This is the first in a series of self-help posts with that goal in mind.

 

The Problem:

One of the first clients we worked with had a not so unique problem – their web application uses query string parameters to determine the content to display on a webpage.  Other eCommerce clients have the same products listed in multiple categories. The first case causes the same urls stems to be shared across different content, and the second case creates multiple urls for the same content.  The SEO solution to this content to url mismatch problem is using canonical tags.  However, from a web analytics perspective, the issue is pretty crippling.  For example, here’s how a content report looks before and after consolidating pages in Google Analytics:

before

after

From gibberish to exactamundo in one week – maybe that’s what I should have titled this post! Welcome to conversion funnel analysis, page next page analysis, and pretty much all sort of insightful analysis in GA!

 

The Solution:

The problem can be addressed using three techniques.

  1. Exclude specific query string parameters
  2. Override page name using _trackPageview variable or Virtual PageViews as Google calls it
  3. Search and replace parts of the url or re-format the url within GA

Before you select any of these methods, get a good handle on the problem you face because you may be able to address it using just one or a combination of the above approaches.

a. This is probably the simplest solution of the bunch. GA now provides a way to exclude those pesky query string parameters from urls.  In GA, click on ‘Admin’ > the profile you want to modify > ‘Profile Settings’.  Add the parameters you want to exclude into the ‘Exclude Query Parameters’ box. Done!

The shortcoming of this approach is that it only addresses duplication caused by query string parameters.  If you need more than that, then read on.

b. Override page name using _trackPageview variable:

The standard Google Analytics code on each page has a line that looks like this: _gaq.push([‘_trackPageview’]);

Replace that line for every page that you want to consolidate with this: _gaq.push([‘_trackPageview’, ‘New page name‘]);

Where you need to replace new page name with whatever you want to name the page.  Since you are going through the effort, might as well make the names as intelligible as possible.  The names could be in plain English, i.e. space characters are acceptable.  So you could have a page named ‘Registration Step 1’ or ‘/registration_step_1’ – you get the idea.  And Google is pretty forgiving about the single quotes or double quotes.  I have seen solutions with double quotes work even though GA’s spec says single quotes are needed.

Things to consider:

  • Tag all these ‘Virtual Pages’ with a unique code so they are not confused with new pages that may be created under similar names. I use the prefix ‘vpv’ to differentiate.
  • Include a keyword that you can use later to reference pages when creating segments or goals.  For example, if you included a keyword ‘vpv-123’ then all you need to do is specify this keyword in the regular expression when grouping pages for goals and segments.
  • Leverage the canonical tag you use for SEO and use it for tracking pages. The solution involves storing the url from the canonical tag in a variable and then referencing that variable when calling the Javascript that executes the GA code for _trackPageview.

Remember – Advance planning is the key to success with GA because once the deed is done, you will either be a hero or the guy/girl who just can’t think two steps ahead!  So write it all out and have someone else poke holes in your solution before you implement.

c. Search and replace part of a url in Google Analytics:

This is a quick an easy way to address page duplicates in GA data.  Best used if you have limited ability to update the page level code.  These changes happen at ‘run time’ in GA.

Use this solution when you need to consolidate a few pages in GA.  A great example of applying this approach is if you use Weebly as your CMS.  Your home page in Weebly has the file name index.html.  So visits to http://www.yourwebsite.com and http://www.yourwebsite.com/index.html are recorded as separate pageviews.  Thank you Weebly!  To fix this using the search and replace filter functionality in GA, you need to have basic knowledge of regex.

In GA, click on ‘Admin’ > the profile you want to add the filter to > ‘filters’.  Click ‘new filter’.

Enter a name for this filter

Select ‘Custom Filter’

Select ‘Search and Replace’

Select ‘Request URI’ in the filter field drop down

Careful Now – remember what I said before? – plan it out first.  Before you go any further, test your changes using a regex tester.

For the above example, you would enter ^/index.html$ into the Search String field

Enter / into the Replace String field.  This is a highly restrictive regex, but you can make it more permissive by allowing for query string parameters etc.

Save it and you’re done!

If your web application is simply the pits, you could use the advanced filter functionality to completely reformat the url to something more intelligible.  The instructions for this approach are within the filters section in Google Analytics.

These are a few of the ways to consolidate pages for Google Analytics.  I’m sure there are others, but these are some of the simpler ones.  Each approach has its pros and cons, so carefully consider what your end goal is before implementing!

Abhi Jadhav is a Managing Partner at Bay Leaf Digital. Bay Leaf Digital helps small and medium sized businesses with Content Marketing and Web Analytics.