Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Funnel Analyzer for time spent in panel

Discussion in 'Unity Analytics' started by Vasilis62, Nov 12, 2018.

  1. Vasilis62

    Vasilis62

    Joined:
    Nov 2, 2018
    Posts:
    15
    Good day everyone.

    I am having some trouble understanding how to utilize funnels. I want to track how much time a user spends on a specific panel. So, I created two scripts, one OnEnable() and one OnDisable(), with a custom event on each that sends the time since that panel appeared. Here is the code for the OnEnable() with the other being similar, besides the name of the parameters:

    public class PopupAppearEvent : MonoBehaviour
    {
    private const string ApName = "popupAppear";
    private Dictionary<string, object> parameterAp = new Dictionary<string, object>();
    void OnEnable()
    {
    string ApName = "popupAppear";
    //parameterAp.Add("ApTime", Time.deltaTime);
    //parameterAp.Add("ApTime", Time.time);
    parameterAp.Add("ApTime", Time.realtimeSinceStartup);
    AnalyticsEvent.Custom(ApName, parameterAp);
    }
    }

    So afterwards, I went to my dashboard to create a funnel with two steps, one being the ApTime (the time the panel appears) and the other being the DisTime (the time the panel disappears), which results on the screenshot I provide below. Is there a way to put them on the same line in the chart, as in starting with ApTime and ending up on DisTIme on the same line?

    Thanks in advance
     

    Attached Files:

  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. Vasilis62

    Vasilis62

    Joined:
    Nov 2, 2018
    Posts:
    15
    I see. Can't I make an event to subtract the time OnEnable() from the time OnDisable() and send that?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I simply meant to include the elapsed time in a single event, and not send two events, one with a start time and one with the end time. How you calculate the elapsed time is up to you.
     
  5. Vasilis62

    Vasilis62

    Joined:
    Nov 2, 2018
    Posts:
    15
    I understand, thank you very much!