Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Noob analytics question - How to track user play time?

Discussion in 'Unity Analytics' started by Nullzero, Sep 29, 2015.

  1. Nullzero


    Apr 24, 2013
    I'm pretty new to analytics, and I am having trouble on how to come up with a way to track the data I want.

    I would like a stat that shows how long the user has played my game for since install. A session lasts anywhere from 3-5 minutes. Internally, I am saving their total play time over all sessions in the PlayerPrefs. For the sake of clarity, let's call this stat "lifetimeplay"

    I would like a way to visualize:
    1) The average "lifetimeplay" of all users
    2) Purchase amounts vs "lifetimeplay"

    I tried submitting the "lifetimeplay" data point to Unity Analytics at the Game Over screen, but I forgot that data would be something like this for a single user:
    Session #1: lifetimeplay = 5 minutes
    Session #2: lifetimeplay = 10 minutes
    Session #3: lifetimeplay = 14 minutes
    Session #4: lifetimeplay = 18 minutes

    So in the Data Explorer, I end up with an Average of (5+10+14+18) / 4 => about 12 minutes. But I don't want the average lifetimeplay of all user sessions. I only want that latest value: 18 minutes, for every user... THEN I want an average of that data point.

    Is there a way to do this in Unity Analytics? I'm still pretty new at this, so I feel like I am missing something obvious! Thank you for the help!
  2. mpinol


    Unity Technologies

    Jul 29, 2015
    Hi @Nullzero,

    There are several different ways you can go about this. One way would be to only send the length of the last game session. This would give you the average amount of gameplay for all users for any particular day as well as a total of all of those averages on the 'View Parameters' section of the Data Explorer.

    Another possible way is if you are interested in seeing comparisons of user lifetimeplay vs purchase amounts you can use a funnel with steps that fill as a player's lifetimeplay value gets higher. Then you could use the Funnel Analyzer 'Drilldown Type' feature to compare the players in any particular step to the Monetization segment.

    You can read more about our features here, There are a lot of possible use cases for these features so don't be afraid to experiment!
  3. Nullzero


    Apr 24, 2013
    Awesome, thank you!

    I like the funnel idea, so maybe I will give that a shot! Thanks!
    mpinol likes this.