You are here

Using Google Analytics for Luminis IV statistics

Submitted by bvacura on Sun, 04/20/2008 - 21:12

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

Luminis Version:

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

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

Thanks for posting it and for fixing it.

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

Hi Brad,

Your session this year was great. I went to d/l the slideshow from the SunGard site but it says there is none available.

Can you please put the power point or PDF up on the site?
Most of the other sessions have the slideshows available for download.

Thanks,
Reuben

I have a different approach in using Google Analytics. Instead of putting the code in the Luminis IV.x nested-tables.xsl files, I decided that it was easier to add the code in one of the inline frame channels that we are using for our tabs.

Most of the channels at Wilkes University are inline frames, so I added the code to one channel per tab (in the webserver) to see how many times the tab is being rendered. The same thing should work if you are using Targeted Content Channels. You should be able to insert the code in the free form html section. If any Luminis updated is installed, this will not affect it since we are not inserting the code in the nested tables.

This will NOT require a restart.

I hope this approach helps.
--------
Roman Cortes
Webmaster
Wilkes University

Great info, thanks for sharing it. I had a couple questions. About how many rewrites did you have to create within Google Analytics? Also, are they using the same set of regular expressions as Apache's mod_rewrite? I've tried a couple of rewrites but haven't gotten one to work as expected yet, and I'm sure it's b/c of the regexps I'm using. Sucks to have to wait 24 hours to find out. ;) 

Thanks for any info.

Dave

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.

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

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, 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 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.

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.

I have a different approach in using Google Analytics. Instead of putting the code in the Luminis IV.x nested-tables.xsl files, I decided that it was easier to add the code in one of the inline frame channels that we are using for our tabs.

Most of the channels at Wilkes University are inline frames, so I added the code to one channel per tab (in the webserver) to see how many times the tab is being rendered. The same thing should work if you are using Targeted Content Channels. You should be able to insert the code in the free form html section. If any Luminis updated is installed, this will not affect it since we are not inserting the code in the nested tables.

This will NOT require a restart.

I hope this approach helps.
--------
Roman Cortes
Webmaster
Wilkes University

We took a different approach that required no changes to the nested-tables.xsl file. In both LIII and LIV you can upload an html snippet file for your graphics header. We created our header look and feel and tacked the google js at the end of it. This gets every page that the header loads on, including the login page. Of course, it doesn't get the other apps like e-mail, group tools, etc. It also does not get the / redirect page. We added the js there as well to make sure we captured our referer information. We've being tracking the data in LIII for at least a year and have it setup in our preproduction env. for LIV. The one drawback with this approach is that it loads first instead of last so if there's a google hold up, Luminis is slow...

-michael
---
Knowledge is power, power corrupts.
Study hard, be evil.

Why is it suggested that we use the legacy tracking code (urchin.js) instead of Google Analytics new tracking code (ga.js)?

Thanks,
Denise

I am interested to hear this as well, since I missed the very beginning of this Summit session, is there a reason we are using the legacy urchin.js over ga.js?

Thanks,

Jake Bishop
Concordia University Chicago

If you're thinking of implementing GA, use ga.js over urchin.js - that's the old legacy code. Google will withdraw support for it before too long. ga.js has been around for quite some time now, so use the one with all the new features.

Please also check my implementation of Google Analytics on Luminis III.3.1. I'm tracking ust about everything - tab clicks, link clicks, form submits, rendering errors etc grouped by channel. This is all based on using a copy of ga.js stored locally on our Luminis server - for speed.

Hi Brad,

I got the JavaScript code from Google Analytics after registering our development server, I have added the Google Analytics code to nested-tables.xsl and restarted the web server.  When I look at the source of the login page, I don't see the Javascript I added. I did insert the code between </xsl:call-template> and </xsl:when>, Is there any thing else I am missing? Any help on this is greatly appreciated.

Thanks
Geetha
 

HI,

 

We are running Luminis IV. Today deployed urchin.js in nestedtables.xsl. Portal seems to be running slow. Does anybody had this problem or may be its something else ?

thanks

Kirti Bodhmage

 

That is why it is usually better to include analytics at the bottom of a web page.  In LumIV's case, this would be footer.jsp

 We've never noticed any slowness.  Is the page, icons, content, etc.. loading but just the footer appears to be slow?

We have had Google Analytics setup on our login.jsp page as well as footer.jsp page for over a year. When I look at the report for our portal, I do not see any URLs that look like tab urls, ie I am looking for something like this - /render.userLayoutRootNode.uP?uP_root=root or /tag.68dfd1825cac10a9.render.userLayoutRootNode.uP?uP_root=root&uP_sparam=activeTab&activeTab=u13l1s2&uP_tparam=frm&frm=.

Are you guys seeing your tab pages in your GA reports by using the footer.jsp method?

I've had my code in the nested-tables file for about a year now and was getting only the tabs. I just recently changed this and added it into the custom.xsl file so now I can see what channels the users are going to. Being in the footer, now I can see who is going to the all the channels as well as the channel manager, layout manager, etc., but I can still see the tabs too.

I've set up filters for my tabs with the tab names, and I've set up a filter for the channel functional name, as well as a filter for internal channel clicks.
So in my report, this is what it looks like:

1. User Default Tab 2,118 1,776 00:05:54 69.27% 65.68% $0.00
2. CatPAWS Tab 566 270 00:03:08 25.00% 41.34% $0.00
3. Internal Channel Link -ctf754.uP 527 101 00:00:41 66.67% 10.25% $0.00
4. Channel Fname=myNorthwest Classifieds 250 110 00:00:14 0.00% 9.20% $0.00
5. Work Resources Tab 147 35 00:02:59 0.00% 17.01% $0.00
6. Home Tab 79 58 00:04:17 0.00% 26.58% $0.00
7. Faculty Tab 41 13 00:02:10 0.00% 17.07% $0.00
8. Internal Channel Link -ctf749.uP
And so on.
Still working on getting the filters set up correctly, but I think its starting to take shape with what we are wanting it to look like.

* I thought I had it in footer.jsp, but did have it in the custom.xml file. Under the custFooter section.

Thanks I also figured out that custom.xsl is the best place for the code. I have Google Analytics in custom.xsl for tabs, login.jsp for the login page (ours does not reference the footer.jsp) and footer.jsp to catch the other pages like the logout page.

I've been grabbling google analytics information (for the last year and a half approximately) and I've always had it sitting in my custom theme's custom.xsl file. There is a custFooter template towards the bottom that you can place it in. I also use this area to put our school's common footer in.

Greg