views:

328

answers:

4

I am using Google analytics and wish to differentiate between two different cases on the home page, specifically depending on the user being logged in or logged out (similar to facebook).

It was suggested to use a different URL for each page, but I am loathe to do at it involves modifying the website structure and involves needless redirects and complexity.

Is there a way to modify the Google analytics to track this (eg so paths through the site are tracked differently for each case)? I have read about tracking events but I don't think this is correct.

+4  A: 

Write out a <meta> tag on the server side if the user is logged in, then check in the js for it and change what is being tracked in the _trackPageview() call?

lucas
Here's the parameter info for "_trackPageview()": http://code.google.com/apis/analytics/docs/gaJS/gaJSApiBasicConfiguration.html#_gat.GA_Tracker_._trackPageview
David
Thanks, I wasn't aware you could add a parameter.
Pool
+1  A: 

this may make it look like another webpage but I use this as an onclick event so I don't see why it could be used here some how;

pageTracker._trackPageview('/unauthorised-homepage-viewer');

alternatively use the _setCustomVar method

Matt Smith
A: 

Google analytics allows you to see content by url, the default in overview, or by title.

You can change dynamically the title of the page.

allesklar
+1  A: 

You could alternatively use custom variables. You'll find the documentation in the Google Analytics help site.

Edit: See especially example 2 under the "Example Use Cases":

For example, if your website offer users the ability to login, you can use a custom variable scoped to the session level for user login status. In that way, you can segment visits by those from logged in members versus anonymous visitors.

pageTracker._setCustomVar(
       1,             // This custom var is set to slot #1
       "User Type",   // The name of the custom varaible
       "Member",      // Sets the value of "User Type" to "Member" or
 "Visitor" depending on status
        2             // Sets the scope to session-level      );
 pageTracker._trackPageview();
phidah