Search Unity

Question UGS Analytics: designing new custom events (futureproofing & best practices)

Discussion in 'Unity Analytics' started by paljan, Apr 13, 2022.

  1. paljan

    paljan

    Joined:
    Feb 9, 2015
    Posts:
    32
    Regarding best practices and futureproofing of custom event design in the new analytics:

    We have a catalogue app with lots of different type of games and contents included. In legacy analytics, due to the data explorer, we used separate custom events for tracking any game-specific actions or playtimes, and had events like "game1_playtime(playtimeInSeconds), game2_playtime(playtimeInSeconds)".

    In the new analytics the features appear to be more allowing towards using more generic events and parameters, meaning we would naturally love to change the schema to be like "minigame_playtime(minigameName, playtimeInSeconds)".

    In regards to for example our christmas campaign, where every day from 1st through 24th december players unlock a new game: in legacy analytics we weren't able to make a single data explorer report with 24 unique custom events added, to compare all the christmas games' data.

    Now for the actual questions:
    • is there a limit to added events or metrics in a data explorer report
    • is there a limit to filters added to custom events (or a combination of added events & filters), if we have less unique events with more parameters rather than multiple unique events with single parameters in the reports.
    • will data explorer be developed towards more customization, or will the SQL data explorer be intended tool for anything more complex or larger
     
  2. unity_Ctri

    unity_Ctri

    Unity Technologies

    Joined:
    Oct 20, 2020
    Posts:
    83
    Hi Paljan,

    Just to clarify in your opening context, are you talking about running analysis over multiple Unity projects, or activities within a single project? (multiple games vs minigames/activities in a single game)

    I'll seek answers to the questions you've asked here and come back to you with answers.
     
  3. paljan

    paljan

    Joined:
    Feb 9, 2015
    Posts:
    32
    Activities in a single unity project!
     
    unity_Ctri likes this.
  4. unity_Ctri

    unity_Ctri

    Unity Technologies

    Joined:
    Oct 20, 2020
    Posts:
    83
    Thanks Paljan,

    We are planning to expand the capabilities of the data explorer, but don't have anything to announce yet.
    Cases that are too complicated to be handled by the new data explorer features will need to be addressed by SQL instead as you say.

    Just so that we could ensure we're considering all the use cases, my colleagues were wondering what you'd like to achieve that you can't currently?

    With regards to your other two questions, there's no hard limits on these - but you may find query time increases the more criteria you add to the explorer.
     
  5. paljan

    paljan

    Joined:
    Feb 9, 2015
    Posts:
    32
    Thank you for the info! Any sort of roadmap or considered features for the new UGS analytics would be much appreciated! However this does satisfy my immediate needs!

    I'm at the early stages of redesigning our legacy analytics event schema and wanting to make it also more manageable, especially considering the new validation in the Event Manager. Most of our concerns stem from the aforementioned catalogue content. In the current legacy implementation, one of our projects has around 300 unique custom events. Around 80% of those events could be made into generic events with the new analytics service, and I'm just trying to ascertain that we are not limiting our report generation in any way with the generic events.

    I will keep designing and come back with more specific questions if they arise!
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I might suggest you get a simple example working outside your game to determine the best design pattern. If you want to message me privately with your ProjectID, I can take a look at your existing implementation and offer any suggestions.
     
  7. paljan

    paljan

    Joined:
    Feb 9, 2015
    Posts:
    32
    Thank you Jeff! I will be in touch via DM if / when needed! Couple of related questions:
    • While possibly undesired, is it technically possible to include both legacy analytics and UGS analytics enabled in the project simultaneously for the beta period, to be able to test the new events and data in release, while still keeping the old custom events and tracking intact in the legacy reporting?
    • Will the new data explorer also backfill all invalid data gathered from the new UGS analytics events, after the events are defined and valid in the event manager? Does the invalid event data have some sort of expiry date?
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Standard events from legacy will be brought over to the beta, custom events will not. I don't believe there is any backfill for previous invalid events.
     
  9. paljan

    paljan

    Joined:
    Feb 9, 2015
    Posts:
    32
    Thanks, just to clarify further:
    • Are we able to keep both legacy analytics and new UGS enabled in the project, release it, and collect different custom event data simultaneously to both data explorers (legacy explorer to keep tracking, while new UGS custom events would simply be for testing for example in a separate environment id)
    • So all invalid events shown for example in the event browser are discarded and only events sent after you specify and enable them in the event manager are saved?
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Custom events are kept separate between the two versions. And correct. For the beta, you must define your custom events before sending them. Otherwise they will show on the Invalid tab. Keep in mind that the syntax for custom events is different for the legacy vs beta.

    Legacy: Analytics.CustomEvent()

    Beta: Events.CustomData()

    https://docs.unity.com/analytics/RecordingCustomEvents.html
     
  11. huxiscarr

    huxiscarr

    Joined:
    Oct 11, 2017
    Posts:
    5

    Hello jeff, I tried to use new analytic custom events but there are not showing any data in funnel, I made some custom events in events manager and also enabled them and on code side I installed the sample project and use the following code to send custom event
    Code (CSharp):
    1.  public static class CustomEventSample
    2.     {
    3.         public static void RecordCustomEventWithNoParameters()
    4.         {
    5.             AnalyticsService.Instance.CustomData("myEvent", new Dictionary<string, object>());
    6.         }
    7.  
    8.         public static void RecordCustomEventWithNoParameters(string EventName)
    9.         {
    10.             AnalyticsService.Instance.CustomData(EventName, new Dictionary<string, object>());
    11.         }
    12.  
    13.         public static void RecordCustomEventWithParameters()
    14.         {
    15.             var parameters = new Dictionary<string, object>
    16.             {
    17.                 { "fabulousString", "hello there" },
    18.                 { "sparklingInt", 1337 },
    19.                 { "tremendousLong", Int64.MaxValue },
    20.                 { "spectacularFloat", 0.451f },
    21.                 { "incredibleDouble", 0.000000000000000031337 },
    22.                 { "peculiarBool", true },
    23.                 { "ultimateTimestamp", DateTime.UtcNow }
    24.             };
    25.  
    26.             AnalyticsService.Instance.CustomData("myEvent", parameters);
    27.         }
    28.     }
    the above given code is from sample project given by unity, I used RecordCustomEventWithNoParameters(string EventName) and call it in start function to send the even, I didnt add any parameters, but its not showing any thing in funnel, have I done something wrong
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You might check in the Invalid Events section of the Event Browser:

    https://docs.unity.com/analytics/EventBrowser.html

    Did you define your custom events on your dashboard and add parameters in Event Manager? This is now a requirement before sending custom events with UGS Analytics.

    https://docs.unity.com/analytics/EventManager.html
     
  13. huxiscarr

    huxiscarr

    Joined:
    Oct 11, 2017
    Posts:
    5
    I have checked Invalid section and there is no invalid event and also I have added new event in event manager and enabled it but didnt gave any parameter as I didnt need it and then call that event in unity
     

    Attached Files:

  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You still need to Assign Parameter. And your screenshot does not show the bottom of the screen where your parameter will show. Also, in your code, you'll probably want to add a Debug.Log statement to ensure that your code is actually executing.
     
  15. huxiscarr

    huxiscarr

    Joined:
    Oct 11, 2017
    Posts:
    5
    Ok I will try it with a parameter
     
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I would recommend sending an actual event, and not the demo event you showed earlier. Please show the actual code you plan to use, then ensure your event definition on the dashboard matches the parameter names and types.
     
  17. huxiscarr

    huxiscarr

    Joined:
    Oct 11, 2017
    Posts:
    5
    im using this code now
    Code (CSharp):
    1.  public static void RecordCustomEventWithNoParameters(string EventName)
    2.         {
    3.             var parameters = new Dictionary<string, object>
    4.             {
    5.                 { "int", 1 },
    6.             };
    7.  
    8.             AnalyticsService.Instance.CustomData(EventName, parameters);
    9.             Debug.Log(EventName + parameters + "ANALYTIC");
    10.         }
    Sending event name L1_S and I have assigned parameter int as integer and sending value as 1 and Im calling this function in Start(), is it ok or im still doing some mistake I tried it in editor but still its not showing me anything, as of now im building it on iOS to check it on device
     
  18. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate, what you do mean by "not showing me anything". Are you seeing your Debug.Log statement in the Editor? And your method name mentions "no parameters" but you are sending a parameter which is a bit confusing. And you are appending a dictionary to a string in your debug statement.
     
  19. huxiscarr

    huxiscarr

    Joined:
    Oct 11, 2017
    Posts:
    5
    Sorry by not showing me anything I meant that in dashboard it didnt count as anything, and I am sorry for the confusion I just use the previous function and modified it without changing the function name, but this was the method which came with example and I am using it but its not working, is there any guide which I can follow step by step to make funnel
     
  20. OwenSquirrel

    OwenSquirrel

    Joined:
    Oct 10, 2021
    Posts:
    10
    @JeffDUnity3D When creating temporary custom events to test with, are there no methods to delete/rename these custom events to avoid cluttering/having unnecessary custom events in the long run?
     
  21. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are working on that. In the meantime, create and use a separate Environment for your testing.
     
    OwenSquirrel likes this.
  22. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Are you seeing your Debug.Log output? You won't be able to create a funnel until your events are working. Please send me your Analytics dashboard URL in a private message, I'll take a look. And please confirm your Debug.Log output.
     
  23. SelimAtasever

    SelimAtasever

    Joined:
    Dec 14, 2021
    Posts:
    4
    Hey everyone. Can someone help me with this, i dont know why its not working :
    I am trying to send Customdata to unity dashboard. I created a custom event called KovanOpenEvent in dashboard->event manager, then when my btn is clicked i call this function below.
    1. Dictionary<string, object> parameters = new Dictionary<string, object>(){
    2. { "MyParameter", "hello there" }
    3. };
    4. AnalyticsService.Instance.CustomData("KovanOpenEvent", parameters);
    5. AnalyticsService.Instance.Flush();
    AnalyticsResult returns OK but in data explorer i see no activity. Any help would be appreciated, Cheers!!!
     
  24. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    AnalyticsResult = OK is associated with legacy Analytics. Please send me your dashboard URL in a private message, I'll take a look.
     
  25. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I'm not seeing the events either. Can you share the code you have for AnalyticsResult? Can you place a Debug.Log statement after the code above and provide a screenshot to ensure it's executing? Also, please provide the code you have for UGS initialization, I'll take a look.
     
  26. SelimAtasever

    SelimAtasever

    Joined:
    Dec 14, 2021
    Posts:
    4
    Hello again. Heres the code:

    Debug.Log("this is before execution");
    Dictionary<string, object> parameters = new Dictionary<string, object>()
    {
    { "smalls", "hello there" }
    };
    AnalyticsService.Instance.CustomData("KovanOpenEvent", parameters);
    AnalyticsService.Instance.Flush();
    Debug.Log("this is after execution");

    I have attached the debug screenshot which shows it executed once, as intended.

    Unity version : 2020.3.20f1
    Analytics SDK version: 4.1.0

    I have attached additionally my custom event and custom parameter from the dashboard.
     

    Attached Files:

  27. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Also, please show your UGS initialization code https://docs.unity.com/analytics/AnalyticsSDKGuide.html
     
  28. SelimAtasever

    SelimAtasever

    Joined:
    Dec 14, 2021
    Posts:
    4
    async void Start()
    {
    try
    {
    await UnityServices.InitializeAsync();
    List<string> consentIdentifiers = await AnalyticsService.Instance.CheckForRequiredConsents();
    Debug.Log("sdk initialize test");
    }
    catch (ConsentCheckException e)
    {
    Debug.Log(e);
    }
    }

    When I debug, consentIdentifiers returns 0 items. (if that is relevant)
     

    Attached Files:

  29. SelimAtasever

    SelimAtasever

    Joined:
    Dec 14, 2021
    Posts:
    4
    it worked thanks! I think there was a delay
     
    JeffDUnity3D likes this.