Using Google Analytics for Luminis IV statistics

Montgomery College is using Google Analytics to gather statistics for the Luminis IV.x portal. I talked a little about this during one of the sessions at Summit, and promised I would post information here about how to do it. The statistics provide us a way to track users logging into the portal, where they're coming from (what part of the country and world), how they got directed to the site (i.e, referring URLs), what type of browser they use and version, the connection speed (i.e, Cable modem, DSL, T1, dialup, etc), average time users spend on the site, tab hits and length of time spent on specific tabs, and so on. To date, there have been visits to Montgomery College's Luminis portal from 67 different countries, and nearly all 50 states.

Google Analytics is free to use. Navigate to http://www.google.com/analytics/ and click on the link "Sign up now" to begin. Once you get an e-mail to confirm your account, follow the links and then sign-in and click kon Analytics under My products. There, you'll need to click the Sign up button and provide Google with your website's URL and assign an account name and set your specific country information and time zone. You'll then need to agree to terms, etc., etc., etc. Then finally, you will see the Legacy Tracking Code (urchin.js) code that you'll need to add to your website. This information looks similar to below:


<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-32188231-1";
urchinTracker();
</script>

This code needs to be added to your Luminis IV.x nested-tables.xsl file in $CP_WEBINF/uPortal/org/jasig/portal/layout/tab-column/nested-tables.
Please be sure to save a copy of nested-tables.xsl BEFORE doing any modifications!!!
Below is the location in nested-tables.xsl to insert that code:

Look for the section: <xsl:call-template name="custTabOn">
and directly underneath the ending tag </xsl:call-template> paste the code from Google Analytics.

This code should be placed between </xsl:call-template> and </xsl:when> This places the code in the section where nested-tables works with the tabs so that you can get tab statistics and other information.

You will need to restart your webserver for the changes to take effect.

In Google Analytics, you will not see any results from adding the code to your Luminis environment until the following day, so keep that in mind.

Tab statistics in Google Analytics are under the Content area. We did re-writes in Google Analytics so that our tabs names were listed rather than the URLs to make it more readable. All of the re-writes are done from the Analytics settings, just click the Edit link for your site and apply filters (searches and replaces) so that in our case the My MC Home tab showed up as "My MC Home Tab" rather than /tag.44a4447c1e016185.render.userLayoutRootNote.uP?uP_root=root& .....

The re-write rule we added is a custom filter for each tab to do a Search and Replace. Below is a sample:

Filter Name: MyMC Home Tab Name Translation
Filter Type: Custom filter
Search and Replace
Filter Field: Request URI
Search String: ^/tag\..*\.render\.userLayoutRootNode\.uP\?uP_root=root&uP_sparam=activeTab&activeTab=u14l1s18&uP_tparam.*
Replace String: My MC Home Tab
Case Sensitive: No

Again, changes to the filters will be able to be seen a day after the changes are made in Google Analytics.

I haven't tried using Google Analytics with LP III.3.3.x, but we do know it works with LP IV.0.2, which is the version we're on at MC. Hope you find this as useful as we have at Montgomery College. We've been able to get some great stats information on the portal using these tools, and the fact that they're free makes it even better.

Brad

0
No votes yet

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

code shows now

Brad -

I changed the code snip in your post so it would display (changed the html brackets to < / > )

great mod - I'm planning on trying this out shortly.

Thanks
-Jon

very nice

agreed, this looks very nice. I will try it too. :)

Thanks for posting it and for fixing it.

Thanks!

Hey Jon, thanks for fixing the code in my post. Was already getting e-mails about the snippet not showing up right, so much appreciated!

Brad

Adding GA to calendar pages

I was disappointed looking at the source code for the calendar pages when I saw they didn't have a single footer "include" into which I could stick the tracking code. Not wanting to edit all the pages, I think I found something that will work. Many of the files include error.jsp. I added the GA tracking code between these lines, and it seems to work:

<jato:content name="IsErrorInlineRequired">

<jato:content name="InlineError">

That adds the code to a lot of the pages. Looks like there's still a few I'll have to get individually.

analytics location question

I just setup the analytics on my test server. But in thinking about it a bit, I'm confused why you would put the analytics code in the tab area. Why not just in the footer.jsp which is included? It is the same area as the tabs, so I'm pretty sure that the google code would see each tab click.

jwhitene at pcc edu

How to set it to run on Lminis III?

We have 1 LP 3 and 1 LP 4 test servers but they are all behind firewall. The only server that I can try is our production server, which is III.3.3.64. Anyone running this on III.3.3.64? I'd like to know how to set it up.

Jason, does it work when you put the code in footer.js?

Thanks,
Arion

it should work in the footer

It should work in the footer, but I haven't tried it yet. The footer.jsp is just a jsp include in luminis IV, so its treated like part of the page.

And I think that the page is essentially reloaded, re-including the footer each time. I guess its just as easy to add it either place. I'll test it out this week and see.

I'm not sure if it acts the same in LPIII or not though. Its been too long since we ran III.

i can verify that it works

i can verify that it works in the footer. I set this up yesterdaychanging the directions as the file location has changed, but the name remains the same and you will need to find the footer section in the template. You will also need to install the code in any other html pages you may have such as the login page if you want to track those items.

I still need to work on the rewrite rules to make it more useful, but the data is coming in to GA from my III.3.1.57 installation.
Thanks for the mod, it helped shave hours off me figuring this out on my own.

To clarify for Luminis III users.

The home (login) page mod is working fine. Just had to edit the login.html snippet located in $CP_ROOT\webapps\luminis\site and drop the GA code there.

For the tabs, you need to edit the nested-tables.xsl located in $CP_ROOT\webapps\luminis\stylesheets\org\jasig\portal\layout\tab-column\nested-tables. Search for "copyright" and that should bring you right into the standard footer section. Look down a few lines for the script with the function OpenNotice(). Insert the GA code right above this script and directly below the /table (closing table tag).

Edit: I noticed another location where this would be helpful, the logout screen. This apparently isn't built from nested-tables, so you will need to edit the logout.thtml file located in $CP_ROOT\webapps\luminis\WEB-INF\templates\portal. Just drop the code in right above the closing body tag.

My data hasn't shown up in Google's dashboard yet, but I can verify that each tab load is calling the script. Use 'Live Http headers' firefox plugin to verify this.