views:

22

answers:

1

I have a Website (MOSS 2007) that has multiple URLS which is tracked by Google Analytics using the following code:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-11111111-1']);
  _gaq.push(['_setDomainName', 'none']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

This has been added to the Master Pages. We now want to break down the reporting so instead of just reporting for the entire site we can see information for different subsites. I could define a separate Analytics ID and have completely separate data, but is there a better way to somehow "tag" the analytics hits so we view either the entire site's information or just SubSite1, SubSite2, etc? The sites we want to do this for have their own master pages, so applying unique code to just the subsites is not a problem.

+1  A: 

You've described a key use case for a Google Analytics feature beta released in Nov '08, called "Advanced Segments".

In essence, you can hide all of your data from the current data view (as well as any subsequent data views) except for one or more of your "sub-sites."

To configure:

  1. From the main Dashboard view (first page after you select Account, then Profile), In the upper right hand corner, you'll see a drop-down menu labelled Advanced Segment. Click the right corner to open the menu and you'll see two check-box menus side-by-side, Default Segments on the left and Custom Segments next to it, which should be empty at the moment

  2. Click Create a new advanced segment (to the left of Default Segments)

  3. To create an Advanced Segment, you need to specify a name, a dimension or metric, a condition, and a value

  4. Dimension/Metric: you select the appropriate one by finding it in the nav panel to the left and dragging it into the outline box marked "dimension or metric"

  5. In this case, you probably want the Dimension called Page under the Content heading. (This dimension is actually the URL.) With your cursor on the grid at the left edge of the "Page" Dimension, drag it up and to the right so that it is inside the "dimension or metric" box

  6. Doing that will cause Condition and Value to appear

  7. Condition: you might want to select Starts With

  8. Value: something like: "/subdirectory_of_subsite/" (without the quotes)

  9. Name: give the segment a Name in the text box near the bottom

  10. I would recommend not clicking on "Create Segment" or "Create and Apply to Report"--yet. Instead, first click Test Segment (middle righthand side of the page) to make sure it works (i.e., it successfully collected pages)

  11. To view data using the Advanced Segment, you have to go into the AS menu and click the checkbox next to that Advanced Segment then uncheck the All Visits checkbox in the Default Segments

  12. Close the AS menu and you are back at the main Dashboard view, which will show you the usual view except that the plots show data only for the Advanced Segment you just created and selected.

A few quirks about Advanced Segments: (i) the are the only GA customization i am aware of that is user-account specific; in other words, everyone who wants to view the data using the AS you just created will have to create it manually. It won't appear in the Profile (as a Custom Filter would for instance); and (ii) AS are superior to Filters in at least one respect--they take effect immediately and creating them and settting/unsetting them no matter how many times, has no permanent effect on your data stored by Google.

doug