What's a reliable way to track how much time users spend in your app? We have the events "Session start" and "Session end" and are using TTC, but have a concern that Session end is triggered when a user for example opens a blog article in the in-app browser.
Hi Marina V., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
The most reliable option in Mixpanel is to use Sessions computed by Mixpanel, and then work with the derived Session Duration (seconds) property—rather than relying on your own “Session start” / “Session end” events alone.
1. Use Mixpanel’s computed Sessions
Mixpanel can compute sessions in three ways: timeout‑based (default), event‑based, or property‑based, and creates virtual Session Start and Session End events with a Session Duration (seconds) property for you.[Sessions overview]You can then: - Measure average session duration directly using Session Duration (seconds) in Insights.[Sessions FAQ]
- Use aggregations (sum, average, percentiles) on this property to study engagement per session.[Use cases]This avoids client‑side timing issues and edge cases in your own start/end events.
2. Avoid inflating sessions with non‑user actions
Your concern about “Session end” being triggered when someone opens an in‑app browser (e.g., to a blog article) is similar to the general issue of non‑meaningful activity affecting session metrics.To keep session time closer to “real” in‑app engagement: - Exclude events that aren’t true user activity in your app UI (e.g., backend/API events, system/marketing events). Mixpanel recommends excluding events such as messages sent, push notifications received, and server‑side events not directly tied to a user action.[Excluded events] - If opening an in‑app browser fires events that should not extend the app session (or should be treated as “inactive” time), you can exclude those events from Sessions in Session Settings, so they don’t keep sessions alive or distort event counts.[Session computation]Note: the docs do not describe a built‑in way to subtract “inactive” segments within a session (e.g., time spent reading a long article vs. actively tapping), only to define when a session ends via timeout or explicit end events.
3. Tune timeout vs. explicit start/end
If your current explicit “Session end” event is too sensitive to navigation patterns, you have two safer options: 1. Timeout‑based sessions (recommended default) Let Mixpanel end the session after X minutes of inactivity (e.g., 30 min). Any non‑excluded event within the timeout window keeps the session alive; otherwise, the session ends at the last meaningful event.[Timeout sessions]2. Event‑based sessions with carefully chosen events If you keep event‑based sessions, make sure your chosen “Session End” event really represents a user leaving your app/session (e.g., explicit logout or closing a workspace), not just opening content.[Event-based sessions]
4. How to report on “time spent”
Once Sessions are configured appropriately: - Use Insights on the Session Start event, aggregated by Average of Session Duration (seconds), optionally converting to minutes with a formula / 60.[FAQ: average session duration]
- If you need average per user, use Aggregate Properties per User → Sum of Session Duration (seconds) and then divide by users.[FAQ: per user]If you share more detail on how your current “Session end” is fired, I can suggest whether timeout‑, event‑, or property‑based sessions would map best to your use case.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
