Track Average Time On Page In Mixpanel

Learn to measure average time on page in Mixpanel Analytics

muffaddal qutbuddin
4 min readMay 17, 2021
source pixabay, by anncapictures

You have a website, similar to medium.com, where users can read content and engage. With Google Analytics integrated you can easily answer questions such as the What is the average time on page spent by the user? What are the top pages where the user stays the most and so on? Because Google Analytics provides an average time-on-page metric that you can use to answer many time-related questions.

But unlike Google Analytics, Mixpanel Analytics doesn’t track any of such metrics. So, unfortunately, no average time spent metric out of the box.

Fortunately, there is a way around tracking time between two events.

This guide will explain how to get the average time on a page in Mixpanel with ease.

Note: This will require a strong technical background so better reach out to the analytics guy for implementation. Let me know if you need my expertise.

Duration Tracking in Mixpanel

Mixpanel provides a way to measure the elapsed time between two events. The idea is to start the timer on one event and end on another and Mixpanel will auto-calculate the duration between two events in seconds.

mixpanel.time_event is used to start the timer and with the name of the event till which to calculate the time elapsed. Let’s understand this with an example

Say we want to track how much time users spent on our blog page. To calculate this we need to start the timer when the user opens a page and stop the timer when the user leaves that page.

So we need two events, page_viewed and page_exit , to be sent to Mixpanel.

page_viewedwhen a user views any page and page_exit when the user exits the page.

Right after the Page Viewed event code add the following code as well to start the timer.

The above code tells Mixpanel that we want to start the time till page_exit event occurs. So when page_exit event is triggered Mixpanel will send the duration in seconds as an event property with that event.

Simple right? One line of code and we get the duration on-page metric.

Average Time on Page in Mixpanel Dashboard

Here are some of the many reports that you can create with duration tracking in Mixpanel.

We will be using Mixpanel’s aggregate properties functionality to get us the report we want. The website offers courses to its users.

Aggregate properties for duration, by Muffaddal

Overall Average Time on Page

average time on page in mixpane,l by Muffaddal

The above pie chart tells us that on average users spend 2000 seconds or 33 minutes on the website. This is not bad considering the website offers courses to the user.

Average Time on Page Trend In the Last 30 Days

Average time on page trend in Mixpanel, by Muffaddal

The trend easily helps us understand how the website is performing over time in terms of making users stay on the site.

Average Time Breakdown By Page

Average time on Page, by Muffaddal

Here we see Web Marketing page has the highest engagement time. And we need to work on other pages to increase their average page time.

Other Ways To Use Duration Tracking

Duration tracking of Mixpanel can be used in many more ways than just time-on-page tracking.

How long users view a popup, the time takes a user to complete a lead form, the time students spend on videos, and so on.

The idea remains the same, start the timer and tell when to stop and Mixpanel will do all the trick for you.

Take this article as a way to grasp the concept and apply it to your business setting to track the duration between two user interactions.

Final Thoughts

Average time on the page is one way to track users' activities on the website. There are more. The key is to have a solid tracking plan to lay out the foundation for your analytics journey.

If you want to learn more about tracking plans here is a good course to start with.

Need help with Mixpanel analytics? Reach me out here

Similar Reads on Mixpanel Analytics

--

--