Ireland & UK Moodlemoot – Analytics to the front

At the Ireland & UK Moodlemoot we presented on the Google-Analytics reporting we had implemented for the site. In this post I will go through what the challenge was, and what reports we were able to achieve. As the implementation requires some changes to Moodle Bas Brands on his blog will focus on what we code we used and how it works to achieve this type of reporting

The challenge

Usually the standard Google Analytics code logs the url of the page. Now for my blog that url is meangingful in its naming:

/programme/ is first level and indicates the page is within that area
/online-presentations/  is the page name and indicates what it is

These urls are easy to understand when viewing in a report, however as with some other applications Moodle does not have these clean URLs (or SEF urls).

A url of a course in moodle could be :
Or a section in a course:
Or a resource in a course:

In a Google report the friendly url makes the report instantly meaningful, whereas the normal Moodle url adds the challenge to go back and see what it is.

So the challenge was to address that in a way that takes advantage of the incredible reporting power or Google Analytics.

I have had this idea for some years, just never had a particular reason to implement it. I have seen others do something similar, but this approach here had a specific reasoning behind it.

Anyhow, on with the show.

Pretty Pictures

Before the pretty pictures, let’s explain what we did. It is a simple approach and it is not a solution for everyone. (yes, better get this in now this is an approach to the solution which may or may not suit you). So with the code implemented for yourself, you can do what we have but you may want different things. We do, just did this as a conceptual demo of the approach.

We had Google Analytics log  this url

instead of the normal one which would have been

It logs /$category/$courseshortname/$sectionname/$activityname/$activitytype

This is our 1st phase of the development we hope to do, we will plan to have custom variables stating role (student/teacher) and other aspects as well, but more on that another time.

The reason for the / in the url is specifically to available of the Page path depth analysis in the Analytics.

I will add later what we intend to do next, hopefully collaboratively with people.

The stats reports here run from the date before the Moot, till the day after. April 1-5th.

Here is a quick overview of the visitor traffic that Google Analytics tracking provides.  In this case the top report is Page Views  vs Visits, with some summary stats below it.

The bottom demographic report shows Operating system in this regard.


It is also possible to show time spent, so the image below is of Average Visit Duration.


URLS dont matter here, just that the code is everywhere on your Moodle site – so within the Theme. This is important and it is why the code solution we went for was a theme change, not a block or mod.

Visitor Flow

Another very handy report, for seeing how users flow through your site (main page, login, course page, forum, view post, etc…)  However you can see from this image that the URL is important here and becomes meaningful.


That red bit is user dropping off at that point. You can also use this kind of analysis to explore your navigation labelling and so on.. but enough on that for now. As with most of G-A you can play with the source item which in this case was Country on the left. It would not surprise someone looking at this to know that the Moot was held there. But it could be many things like city, or operating system filtered for Returning Visitors only..


That was audience standard reporting, what about content (pages etc) reporting? Well, now it gets a bit fun!


Now we see the Page urls in the results below. And you can see what we have done with urls and that the report is instantly readable.

Then you can get more info on the Pages

So I can see that The glossary in the best practices course has an average of 2 minutes on a page. 337 views, 84 unique.  Hmmm Michelle will like that I am sure.

We can look at referral traffic (where the person came from when clicking a link to the site) – I have doctored image to remove some person info. So we can see most came from the main Moot website, then twitter links, and mostly afterwards the email alerts. But 71% was direct traffic who type in the URL or had a bookmark.


Custom Reports and Dashboards.

Thats all well and good for normal reports, but when you build custom reports and dashboards the fun really begins.


There is a number of widgets on the dashboard which show specific information. Like the pageviews/traffic for a specific course over the 5 days.  These widgets are configured easily as below:


This only counts the traffic where Page Page level 2 contains /workshops/  which is the unique course shortname.  This is the very reason we went with this approach.

So how about a whole dashboard on one Moodle course only?

These widgets all filter on the course level for /game/ and show different aspects.

But there is more. Path level rocks.!!

With this report, I can then dril down a category (in this case 2012), into one course and then see a list of the section names that people spent time in the items within that section. and could also dril further to see the usage of the items within that section alone


Custom Report with option to drill down

Custom Report Drilled down 2 path levels

Custom Report Drilled down 2 path levels



Now of course if you were (for some, or maybe all courses) want to give this info to each teacher or school/faculty admin you would not want to give them access to the main G-A login, so you can either

a) download the PDF of the report – [attach pdf]
b) Have it email them the report, daily, or weekly, monthy etc.

So by setting up a dashboard for each course that you want to the overall usage can be fed right back to the people who want to know.

Future Development Ideas ….

This was just the first implementation of the solution as a visible proof of concept and approach. Although I have a clear idea of how this “could” progress what would be better is to get a group of like-minded people together to collaborate on this going forward, or at least that is the idea. Get in touch!

So, what are the possible future roadmaps bits?

– Using Custom Variables in G-A to track visitor used related aspects such as

  • the main role of a user from a hidden profile field (staff vs student or Job Title, or work department)- useful for breaking down activity by a new visitor option
  • perhaps even an anonymous hash which correlates to a user within Moodle, just g-a does not know it.

– Using page related variables to track certain aspects of visit (category for example) instead of URL paths

– Exploring logging Event tracking for activity completion or completions

– Building a settings page / config to control which variables are logged in the various parts of the implementation as no two sites would probably want to same data

– Build an email messaging scripts that takes the PDF sent via email by Google-Analytics for a report, and inserts it to a course for the teacher.

– build a plugin which replicates moodle logging calls into analytics calls as a more 1-1 outsourcing of the inbuilt statistics

– Exam using the analytics API to extract data and produce reports in Moodle using Google-Chart rather than report via email or the Google Analytics interface.

Well, that is some ideas, I am sure that there will be many variants to tackle all the use cases that people want to implement, but perhaps we can get a group to work through some of these together.

Technical Implementation

So for the technical aspect, I suggest you pop over to Bas Brands blog.

This entry was posted in Moodle and tagged , , , , , . Bookmark the permalink.

5 Responses to Ireland & UK Moodlemoot – Analytics to the front

  1. Mike Wilson says:

    Hi Gavin,

    We’re doing some work with G-A at the moment. It’s a great tool. We are particularly interested in desktop vs mobile vs tablet usage of Moodle as we continue our pilot. I’ve set-up a dashboard to keep track of a few things and it’s producing some quite interesting stats so far.

    Next step for us (as you’ve covered in your article) is to create dashboards for a few specific courses. Then we want to move onto student, staff and department reports.

    I’m used to writing admin reports for Moodle, but G-A makes reporting much quicker and flexible. We’d be very interested in diong some collaborative developments with Moodle & G-A.

  2. Pingback: Gamifying a Moodle course. What difference does it make? Week 7 | I Teach With Moodle | Sharing good practice using Moodle in and out of the classroom

  3. Matt says:

    When using this google analytics integration (using the essential theme) I don’t get the “Page Timings” in Google Analytics, which means I can’t tell which pages are loading quickly and which aren’t. Is this something that other people are experiencing?



  4. Pingback: Moodle Essential Theme 2.4 | Moodleman Blog

  5. Pingback: A Quick Look at Piwik Analytics for Moodle | Some Random Thoughts

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>