At work, we use Sungard HE's Luminis portal (v3.3) — It's been good to us over the years, but there's a lack of usage information regarding users' roles and their interactions with Luminis.

In the past, we've added Google Analytics to Luminis to track the interactions, but never managed to fully segment user roles. Until now.

Out of the box, Luminis has roles such as staff, student, faculty, ProspectiveStudent etc. Users can have one or more of these roles and other custom roles too. If we could capture all the roles and pass them onto Google Analytics, then we'd be able to fully segment the user types and gain a better understanding of how each segment uses Luminis.

This post aims to show how this is possible in just 3 steps:

  1. XSL: Edit nested-tables.xsl to add a custom meta tag for the luminis roles
  2. Javascript/jQuery: Read the custom meta tag and set a custom variable in Google Analytics
  3. Google Analytics: Create custom segments to view traffic for specific Luminis roles

Edit nested-tables.xsl and add a custom meta tag to the header

We've seriously hacked at nested-tables.xsl over the years, so our version of the file is likely to be different to most. The main aim here is to find the html > head section and add a custom meta tag:


<!-- Dump all roles into a single meta tag as a comma separated value -->
<meta name="luminis.role">
<xsl:attribute name="content">
<xsl:for-each select="//layout/cp:cpInfo/cp:cpProperty[@name='pdsRole']/child::*">
<xsl:value-of select="concat(., ',')" />
</xsl:for-each>
</xsl:attribute>
</meta>

Read the custom meta tag and set a custom variable in Google Analytics

Our implementation of Google Analytics is a little complex, but this example I've based on the standard Google Analytics example code.

Using Javascript (infused with jQuery in our case), we can read the custom meta tag and set a custom variable.


<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">

window.onload = function(){
try
{
var pageTracker = _gat._getTracker("UA-XXXXX-XX");

if (typeof $('meta[name=luminis.role]').attr("content") == 'string')
{
pageTracker._setCustomVar(
1, // This custom var is set to slot #1 of the 5 available in GA
"luminis.role", // The name acts as a kind of category for the user activity
','+$('meta[name=luminis.role]').attr("content"), // The value of the custom variable (starting with a comma)
2 // Sets the scope to session-level
);
}
pageTracker._trackPageview();
}
catch (err) {}
}

</script>

According to the documentation, it's important to set the custom variable before tracking the page view.

Create custom segments to view traffic for specific Luminis roles

Sign in to Google Analytics and view your normal website reports.
Click on Advanced segments | Create a new advanced segment

Create a new segment where...
Custom variable (Value 1) contains ,staff,
AND
Custom variable (Value 1) contains ,faculty,

Note the surrounding commas - we're using them as role delimiters.

Give the segment a name e.g. "Luminis roles: staff AND faculty""

Create  custom segment

All done, but have patience

Your custom segment is now available from the advanced segment drop-down:

select-custom-segment

Custom variables seem to take longer to filter through to Google Analytics than normal data such as page views. So come back in a couple of days and try out your new advanced segment.

Update (12 April 2010):
Shortly after I published this post, the Google Analytics blog posted their webinar on Google Analytics custom variables.

Also, if you're interested in creating advanced segments from custom variables, I've posted ayoutube video that steps through the process.