Add loggedin/logged out differentiation to Google Analytics.

This commit is contained in:
Max Goodman
2011-05-25 11:26:03 -07:00
parent a34347914b
commit 77b7cfac36
2 changed files with 5 additions and 0 deletions

View File

@@ -157,6 +157,10 @@ class UserInfo(Info):
return name
return '-'.join((name, action))
@staticmethod
def get_usertype():
return "loggedin" if c.user_is_loggedin else "guest"
def init_defaults(self):
self.name = safe_str(c.user.name if c.user_is_loggedin else '')
self.site = UserInfo.get_srpath()

View File

@@ -109,6 +109,7 @@ reddit, reddit.com, vote, comment, submit
_gaq.push(['_setAccount', '${g.googleanalytics}']);
_gaq.push(['_setCustomVar', 1, 'site', '${UserInfo.get_site()}', 3]);
_gaq.push(['_setCustomVar', 2, 'srpath', '${UserInfo.get_srpath()}', 3]);
_gaq.push(['_setCustomVar', 3, 'usertype', '${UserInfo.get_usertype()}', 2]);
_gaq.push(['_trackPageview']);
(function() {