This was something that I found REALLY useful in the v3 forum, so I thought I'd post it here with an update so that it works using the v4 code. If you have google analytics on your page, just put this code at the bottom of your footer (be sure that this comes AFTER the analytics tracking code script): HTML: <?php require_once '/home/crogue/public_html/member/library/Am/Lite.php'; ?> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-XXXXXXXX-X"); pageTracker._trackPageview(); pageTracker._setVar("<?php if (Am_Lite::getInstance()->isLoggedIn() ) echo Am_Lite::getInstance()->getUsername(); else echo '_NotLoggedIn'; ?>"); } catch(err) {} </script> Now when you go to google analytics, under Audience > Demographics > User Defined you'll be able to track each user's: VisitsPages/VisitAvg. Time on Site% New VisitsBounce Rate Pretty useful.
Thanks Mr. Charming... I wish more experienced users (or programmers) would post useful and helpful code for us newbies to learn from. I will definitely be using your example, once we go live with v4.
Nice bit of code! Looks like you could also use that to seperate out free/paid members to figure out what your popular content is. Thanks for sharing. David
Wonder if this could be extended to IP address, allowing you to build a poor mans GetClicky, allowing you to track specific users (by IP) through to conversion (by username).