1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Differentiating Members and Guests in Google Analytics

Adding custom variables to Google Analytics

  1. Jaxel

    Jaxel Well-Known Member

    Jaxel submitted a new resource:

    Differentiating Members and Guests in Google Analytics - Adding custom variables to Google Analytics

    Read more about this resource...
     
  2. Dakis

    Dakis Well-Known Member

    Thanks for clarifying this up, nice work!
     
  3. Dakis

    Dakis Well-Known Member

    It still shows up zero for both members and guests in my account today. :(

    This is what my analytics template looks like:

    Code:
    <xen:if is="{$xenOptions.googleAnalyticsWebPropertyId}"><script>
    
        var _gaq = [['_setAccount', '{$xenOptions.googleAnalyticsWebPropertyId}'], ['_trackPageview']];
        _gaq.push(["_setCustomVar", 1, "Registered", "{xen:if $visitor.user_id, 'member', 'guest'}", 1]);
        !function(d, t)
        {
            var g = d.createElement(t),
                s = d.getElementsByTagName(t)[0];   
            g.async = true;
            g.src = ('https:' == d.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            s.parentNode.insertBefore(g, s);
           
    
        }
        (document, 'script');
    
        </script><xen:comment><!--Adapted from http://mathiasbynens.be/notes/async-analytics-snippet--></xen:comment></xen:if>
    And this is what the segments look like:

    upload_2013-12-16_11-26-22.png

    upload_2013-12-16_11-26-50.png

    any ideas ?
     
  4. Jaxel

    Jaxel Well-Known Member

    You have them as Key 1 and Value 1 right? Also, be patient, it will take time for data to populate.

    1.jpeg
     
  5. Dakis

    Dakis Well-Known Member

    Yes, I do, you can actually see it on the right end of each screenshot.

    I'll report back in a few days :)
     
  6. WhoIsDo

    WhoIsDo Active Member

    Been a little over 24 hours, and this doesn't appear to be working. I've checked your steps and what I've entered, and everything is 100% exactly how you have yours.
     
  7. Dakis

    Dakis Well-Known Member

    Yeah it's not working for me either.
     
  8. Dakis

    Dakis Well-Known Member

    This does not work - anyone knows how to fix it?
     
  9. Jaxel

    Jaxel Well-Known Member

    Dakis likes this.
  10. Dakis

    Dakis Well-Known Member

    Thanks I've made the change and will post the results :)
     
  11. WhoIsDo

    WhoIsDo Active Member

    Works for me after the change. Thanks!
     
  12. Dakis

    Dakis Well-Known Member

    Hey @Douglas Veney can you post your google analytics template here? Mine still doesn't work so I must've done something wrong this time.

    this is mine:

    Code:
    <xen:if is="{$xenOptions.googleAnalyticsWebPropertyId}"><script>
    
    var _gaq = [['_setAccount', '{$xenOptions.googleAnalyticsWebPropertyId}']];
    _gaq.push(["_setCustomVar", 1, "Registered", "{xen:if $visitor.user_id, 'member', 'guest'}", 3]);
    _gaq.push(['_trackPageview']);
        !function(d, t)
        {
            var g = d.createElement(t),
                s = d.getElementsByTagName(t)[0];   
            g.async = true;
            g.src = ('https:' == d.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            s.parentNode.insertBefore(g, s);
        }
        (document, 'script');
    
        </script><xen:comment><!--Adapted from http://mathiasbynens.be/notes/async-analytics-snippet--></xen:comment></xen:if>
     
    Last edited: Jan 7, 2014
  13. loplo

    loplo Active Member

    Same here, guests and member = flat line.
     
  14. DBA

    DBA Well-Known Member

    Are you guys using this with [Google] Universal Analytics?
     
  15. loplo

    loplo Active Member

    Yes, I do.
     
  16. Dakis

    Dakis Well-Known Member

    I am removing this as it doesn't work for me unfortunately, shows zeros for the custom segments. :(
     
  17. loplo

    loplo Active Member

    I've found and solved the problem. On my forum it was a conflict between this modification and "Better Analytics" creatd by @digitalpoint .
    Disabling "Better Analytics", the member and visitor counter started to work.
     
    Dakis likes this.
  18. Dakis

    Dakis Well-Known Member

    Ah, thanks for clarifying that, good catch. In that case, I'll just wait for @digitalpoint to release his plugin, as it will capture more information. :)
     
  19. Kerby

    Kerby Active Member

    In the GA javascript code, are the red charactes needed? It seems to me that they can be removed.

    var _gaq = [['_setAccount', '{$xenOptions.googleAnalyticsWebPropertyId}']];
     
  20. cdub

    cdub Well-Known Member

    I've had to remove the entire google_analytics template and just paste in only the analytics code from google there. It was the only way I was able to get analytics and webmaster tools to work.

    How can I do this if I just have the analytics code from google pasted in there?
     

Share This Page