Track Time Spent on Thinkific Courses

source pixabay, by anncapictures

Thinkific is a platform to make it easy to create, market & sell online courses. Everything you need to run your education business under one roof.

However, one thing it lacks is the ability to track the session duration for each student. You can’t monitor how much time students spent on courses.

We can leverage Mixpanel analytics for this purpose. It allows analyzing user's (students in our case) behavior across your sites with a real-time cohort.
The best part is Thinkific has direct integration to Mixpanel.

Here is how it will look in the Mixpanel

Lesson duration report of Thinkific in Mixpanel, by Muffaddal

But having Mixpanel integration with Thinkific doesn’t mean we will get the session duration tracking reports in Mixpanel. We have to tailor Mixpanel tracking to attain our objective. And that’s this article will help you explain.

Note The method requires a Javascript background. And I won’t go into detail about the code-related stuff here. So better ask a technical person in your team to do this for you.

Let me know if you need my help on this.

There are two concepts that we need to grasp to make this work for us.

First is how Mixpanel tracks time with the event.
The second is how to employ that with Thinkific’s callback functions

let discuss them one by one in detail.

Duration Tracking in Mixpanel

To calculate duration in Mixpanel we have to tell it when to start the timer and when to stop it. Here is how it is done.

To start timer we call mixpanel.time_event and pass along the name of the event till which to calculate the time elapsed.

Suppose we want to calculate the time between login and log out of users. We will call mixpanel.time_event when the user login and pass it to log out event name. Here is the example code for it.

duration tracking in Mixpanel

We have to follow the same idea for Thinkific.

Thinkific Callfack Functions

Thinkific provides callback functions that get triggered when a user performs a certain action. Below are the hooks currently available.

callback functions available in Thinkific

Now how to employ these to get us the duration tracking in Mixpanel? We need to do two things. First, when a user views any course we trigger mixpanel.time_event call. Second, send the name of when the user exit the page.

To start the timer hooks:contentDidChange is what we need. It triggers when a new lesson is viewed.

To stop the time hooks:contentWillChange can be used. It triggers when a user is about to leave a lesson.

duration tracking flow in Thinkific, by muffaddal

Above will get us the duration for most of the cases except for one.

There is one edge chase where users instead of marking the lesson complete they close the browser tab. In this scenario, we will have to make use of javascript’s callback function that triggers before the browser window is about to close.

The callback function is: beforeunload.Code will remain the same as contentWillChange only the handler is different.

And done!

no net yet, we still have to add the code to the website.

Add Custom Code in Thinkific Website

We know what to do with the code, but the question is where to add it? Thinkific provides a way to add any custom code inside the footer section of the website. To do so, go to settings>site footer code>code & analytics tab.

add code to the footer section of Thinkific website, source Thinkific

Paste the code in the code layout depicted above, hit save, and changes will start to reflect immediately on the website. You can go to Mixpanel’s live view to see events in realtime.

Reach me out if you need help tracking time spent by users on your courses.

References

Check out the below article for further instructions about the footer code and callback function of the website

--

--

--

Muffaddal has around 5 years of experience working with web analytics and user behavior data. https://www.linkedin.com/in/muffaddal-qutbuddin/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Test Function Integration

Testing components that make API calls

How to Setup Next Gen Images for React Hosted on Amazon S3

Debouncing patterns for React Events

Top 5 Android Libraries — June 2017

YDKJS: Generators, Performance, and Benchmarking

4 Common Mistakes When Using React to Avoid

Webix Jet framework through the eyes of a freshman. Part 1. Composition and Navigation

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
muffaddal qutbuddin

muffaddal qutbuddin

Muffaddal has around 5 years of experience working with web analytics and user behavior data. https://www.linkedin.com/in/muffaddal-qutbuddin/

More from Medium

3 Steps to Creating the Perfect Employee Learning and Development Plan

Fundamentals of Statistics for Testing in Growth Marketing

Introduction to Form Abandonment

Understanding Generation Z’s Media Consumption Habits to Improve Your Marketing Strategy