Resource icon

Unmaintained Track Usergroups in Google Analytics

Finally updated it to work with Universal.

In Google Analytics go to the Admin tab and select Custom Definitions under your Property. Add your new Custom Dimension's, I only did a Logged-In and Guest.

Screen Shot 2016-08-23 at 2.23.45 PM.webp

Add the new code to the google_analytics template on your website like this (be sure that your dimension numbers match with the code on Google Analytics):
PHP:
    ga('create', '{$xenOptions.googleAnalyticsWebPropertyId}', 'auto');
<xen:if is="{$visitor.user_id}">
    ga('set', 'dimension1', 'Logged_In');
<xen:else />
    ga('set', 'dimension2', 'Guest');
</xen:if>
    ga('send', 'pageview');

On Google Analytics you'll want to create two new Segments, the Custom Dimension filters are under the Advanced tab (see screenshot). The text you enter here needs to exactly match what's in your tracking code (for example Logged_In or Guest)
Screen Shot 2016-08-23 at 2.35.19 PM.webp
Top Bottom