Differentiating Members and Guests in Google Analytics

Differentiating Members and Guests in Google Analytics

Jaxel

Well-known member
#1
Jaxel submitted a new resource:

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

So Google Analytics is nice; but one thing it doesn't do is show you what percentage of users on your website are logged-in members, or logged-out guests. You can see how many people visit your forum; but you can't see how many of those people bothered to register or log-in. Without these stats, it can be hard to see how effective methods to convince people to register can be. So this is a small series of edits that will help Google Analytics record this statistic.

The first thing you will...
Read more about this resource...
 

Dakis

Well-known member
#3
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 ?
 

WhoIsDo

Active member
#6
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.
 

Dakis

Well-known member
#12
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:

loplo

Active member
#17
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.
 

Kerby

Well-known member
#19
In the GA javascript code, are the red charactes needed? It seems to me that they can be removed.

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

cdub

Well-known member
#20
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?
 
Top