Page 1 of 2 1 2 LastLast
Results 1 to 15 of 22

Analytics Segmentation Tracking

This is a discussion on Analytics Segmentation Tracking within the Analysis: Traffic & SERPS forums, part of the vBulletin SEO Discussion category; Hello, those of you who want to apply segmentation tracking in Google Analytics for your forums guests vs. members, you ...

  1. #1
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times

    Analytics Segmentation Tracking

    Hello,

    those of you who want to apply segmentation tracking in Google Analytics for your forums guests vs. members, you can use __utmSetVar() function for that.

    That function sets the cookie for visitors, so it is enough to put this on the login page only, find this in functions_vbseo.php file:
    PHP Code:
    if(THIS_SCRIPT == 'register'
    and add above:
    PHP Code:
            if(THIS_SCRIPT == 'login' && $GLOBALS['bbuserinfo']['userid'])
            {
                
    $newtext preg_replace('#(</body>)#is','
    <script type="text/javascript">
    pageTracker._setVar("member");
    </script>
    '
    .'\\1',$newtext,1);
            } 

    That will not affect users that are already logged in though (or have "remember me" enabled), so if you want to apply it for every page load for members, the code would be:
    PHP Code:
            if($GLOBALS['bbuserinfo']['userid'])
            {
                
    $newtext preg_replace('#(</body>)#is','
    <script type="text/javascript">
    pageTracker._setVar("member");
    </script>
    '
    .'\\1',$newtext,1);
            } 

    Note: make sure that you applied updated Google Analytics code as described in New Google Analytics Code
    Last edited by Oleg Ignatiuk; 03-21-2008 at 05:10 AM.
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  2. #2
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    Note: This is for the OLD Urchin style Analytics.

    If you upgraded to the new version,
    you need to use

    pageTracker._setVar('member');

  3. #3
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Thanks Brian, I've corrected the code above!
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  4. #4
    Senior Member
    Real Name
    John
    Join Date
    Dec 2005
    Posts
    691
    Liked
    17 times
    Hum, so using the above you could actually define separate segments. Users that logged in and users that are already logged in.

  5. #5
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    It should allow to separate member visitors from guest visitors.
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  6. #6
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    Oleg,

    I streamlined this whole process, including the registration funnel. It puts everything into one script tag nice and neat.

    see attached. It replaces the whole
    if(VBSEO_ADD_ANALYTICS_CODE) { }
    conditional.


    This produces nice code

    Code:
    <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">
    	var pageTracker = _gat._getTracker("UA-xxxxxx-1");
    	pageTracker._initData();
    	pageTracker._trackPageview();
    	pageTracker._setVar("member");
    </script>
    and on the registration (assumed logged out):

    Code:
    <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">
    	var pageTracker = _gat._getTracker("xxxxxxxx");
    	pageTracker._initData();
    	pageTracker._trackPageview();
    	pageTracker._setVar("guest");
    	pageTracker._trackPageview("/google-funnel/enter-birthday.html")</script>
    Attached Files

  7. #7
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    it should also be noted that if you are using the new GA tracker, that the 'outgoing' script needs to be addressed from urchinTracker() to the new pageTracker as well.


    on functions_vbseo_seo.php at about line 60 find
    Code:
    $linkout = 'urchinTracker (\'' . VBSEO_ANALYTICS_EXT_FORMAT . $linkout . '\');';
    replace with

    Code:
    $linkout = 'pageTracker._trackPageview(\'' . VBSEO_ANALYTICS_EXT_FORMAT . $linkout . '\');';
    and also on
    functions_vbseo.php around line 1288

    find:

    Code:
    $newtext = preg_replace('#^(\s*pd\[\d+\] = )\'(.+)$#me', '"$1\'".preg_replace("#(urchinTracker \\()\'(.*?)\'#","\$1\\\'\$2\\\'", str_replace("\\\'","\'","$2"))', $newtext);

    replace with:

    Code:
    $newtext = preg_replace('#^(\s*pd\[\d+\] = )\'(.+)$#me', '"$1\'".preg_replace("#(pageTracker._trackPageview \\()\'(.*?)\'#","\$1\\\'\$2\\\'", str_replace("\\\'","\'","$2"))', $newtext);
    That should get you 100% up to speed on the latest trackers

  8. #8
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Great idea on consolidating analytics code, thanks Brian!
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  9. #9
    Member
    Join Date
    Oct 2005
    Posts
    46
    Liked
    1 times
    Oleg,

    Are you going to incorporate this into a future release of vBSEO? It would be great to have an option to be able to see our Analytics by members or guests.

  10. #10
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Yes, that will be included in the next vBSEO version.
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  11. #11
    Senior Member
    Real Name
    John
    Join Date
    Dec 2005
    Posts
    691
    Liked
    17 times
    Quote Originally Posted by Oleg Ignatiuk View Post
    Yes, that will be included in the next vBSEO version.
    Sweet!

  12. #12
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    Just to update....

    DO NOT use the 'guest' tracker. Doing this will forfeit all your bounce rate stats.

  13. #13
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Please try to move setVar() tracking function *above* the _trackPageview() and *below* _initData() lines, that seem to be working correctly with Bounce rate report.
    Last edited by Oleg Ignatiuk; 06-16-2008 at 06:47 AM.
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  14. #14
    Member
    Real Name
    Alex B.
    Join Date
    Mar 2007
    Location
    Brooklyn, NY
    Posts
    46
    Liked
    0 times
    This should definitely be included in the next VBSEO version!!!

  15. #15
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    Alex, this is already in RC5 and will be for sure in gold as well

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Google Analytics: Tracking of Usernames
    By DBB in forum General Discussion
    Replies: 5
    Last Post: 08-17-2009, 10:49 PM
  2. Google Analytics not tracking after install
    By ehmax in forum Analysis: Traffic & SERPS
    Replies: 7
    Last Post: 03-31-2007, 04:09 PM
  3. Analytics Tracking Not Installed
    By lindmar in forum Troubleshooting
    Replies: 10
    Last Post: 10-04-2006, 04:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •