Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'd like to be able to run two different 'tracks' for Google Analytics; One for anonymous users of the site and another for Users whom are logged-in.

I say "track" because I'm not sure of the term -- but I definitely know I want it to all be in the same "Analytics Account", I just want to segregate my logged-in users.

In the site template, I can very easily add a conditional to display one or the other (Analytics code snippet)... Which I'm hoping this comes down to and although I'm not sure, it seems that the last digit in your Analytics ID (e.g. UA-15XXXX0-X) could be incremented to gain such additional 'tracks'.

My current footer snippet:

<script type="text/javascript"> 
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript"> 
    try {
        var pageTracker = _gat._getTracker("UA-XXXXXXX-1");
        pageTracker._trackPageview();
    } catch(err) {}
</script>
share|improve this question

1 Answer 1

The last digit in the Analytics ID (the final X in your example) denotes a specific tracked site. The first portion (UA-XXXXXXX-YY) denotes the Profile the site belongs to (useful for grouping collections of sites when tracking lots).

As far as I'm concerned, the best way to track multiple streams under one Analytics ID - to keep all data under one site's profile - would be to append a new/different UTM tag onto the URL after the user is logged in, and optionally onto all pages during the logged-in session. Creating multiple Analytics IDs and then rewriting the code depending on whether a user is logged in or not can be extra work for no real reason as you can't easily cross-compare between two sites to track anonymous and authenticated users. (I can appreciate you may have a good reason for doing it this way, however.)

Intown Web Design and Google's own Analytics Help pages (specifically the Analytics URL Builder tool) are highly useful resources to learn and experiment with UTM tagging.

share|improve this answer
    
This makes sense and likely the direction I need to go. I edited my question, adding my current footer snippet. The links you cite are helpful, but how do I add this/these variables to my footer snippet? –  Ben Keating Jun 30 '11 at 23:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.