The profound rantings of the one like Tom Atkinson… and now art gallery and shop.

How to show fully qualified URL in Analytics

The following advanced filter can be used to modify how URLs are recorded in your Google Analytics account. I recommend applying this to a test profile before putting this on your main profile, since as it affects the URLs recorded this has the ability to wipe out your Goals since it changes the URLs of every hit.

Here's how its done:

1. Click the "+ Add Filter" window from the profile settings screen (its under "Filters Applied To Profile")

2. Choose either Add New Filter for profile or Apply Existing Filter to profile. The second option is handy if you have already defined a few filters for other profiles in the account. The idea is that once you have defined a filter, you can easily just add it to a profile without redefining it.

3. Check the radio button for "Custom Filter" (it will be set to Predefined Filter initially) and this should change the way the form looks to something like the screenshot below.

4. Check the radio button for "Advanced" which should open up all the advanced controls.

5. In the Field A -> Extract A section, set the controls to "Hostname" and (.*) for the text field. This opens up a regular expressions "capture" group that stores the hostname of the page in variable $A1. This is actually the domain name of the page with your GA codes, normally just one website, but this fully qualified url filter is handy for making "rollup" trackers that can be place across an entire enterprise of sites with different domain names (more on that later).

6. In the Field B -> Extract B section, set this to "Request URI" and (.*). The regular expression is another capture group that will stash the full path in to variable $B1. The path is usually something like /contact-us.html for example.

7. In the Output To -> Constructor section, set this to "Request URI" and the expression to: /$A1$B1. Don't be tempted to put /$A1/$B1 since the path variable already starts with a forward slash, whereas the domain name does not have a slash (its just a domain name). This will join the "" in your domain name $A1 with the path "/blog/online-marketing/google-analytics/how-to-show-fully-qualified-url-in-analytics" in your $B1 variable together to give the full URL (minus the http:// part) as: (this is the hit that will show in your Top Content report).

8. For the remaining checkboxes, put a tick in Field A required, Field B required, Override Output Field. Ensure your Case Sensitive is set to "No" which is most likely the best option for most people.

9. Hit save, do some hits to your site, and wait 24 hours for the reports to come through.

10. If its working you should see something like this:

The resulting top content report now shows the fully qualified URL. My first try shows a configuration error - notice the double slashes after the domain name? This is a good example of why you should do this in a testing profile before applying to the main profile, as this was caused by my regular expression of /$A1/$B1 which I have now changed to just /$A1$B1.

Posted by tomachi on November 2nd, 2009 filed in Google Analytics