Search Unity

Strange Custom Events problem

Discussion in 'Unity Analytics' started by alleballe90, Mar 5, 2017.

  1. alleballe90

    alleballe90

    Joined:
    Jan 9, 2017
    Posts:
    7
    Hi,

    I'm using Unity 5.60b3
    I've been trying to implement Unity Analytics in my game for a couple of days now but having inconsistent results. An example of how I am doing this is:

    Analytics.CustomEvent("inGameCurrencySpent", new Dictionary <string, object>
    {
    { "coins", cSpent},
    { "orbs", oSpent }
    });

    The validation of the Custom Events is the issue. The results are always inconsistent. Sometimes they show up (Services Tab > Validator and Validation section from the dashboard) and sometimes they don't. The "appStart" and "appRunning" events also show up sporadically. Sometimes they show up and if I am lucky I can manage to validate one or two Custom Events. The annoying part is that since I'm getting an "Ok" I only get to try validating events 100 times before having to wait an hour. I have noticed that if I restart Unity it will SOMETIMES work for a while.

    Recap:
    Create a button to call:
    public void CurrencySpent(){
    Analytics.CustomEvent("inGameCurrencySpent", new Dictionary <string, object>
    {
    { "coins", cSpent},
    { "orbs", oSpent }
    });
    Debug.Log(Analytics.CustomEvent("inGameCurrencySpent");
    }

    • Navigate to the Validator from the services tab.
    • Play the game from the editor.
    • Sometimes the appStart event will show up and sometimes the appStart AND the appRunning will show up and sometimes none of them will show up.
    • Click the button to call the Custom Event.
    • Get the "Ok" in the console.
    • Sometimes it will show up and other times it won't. (Seems to coincide with the appStart and appRunning showing up)

    Any ideas? As of now I'm literally spending hours just randomly trying to fire off the Custom Events until they show up and like I said earlier, it's really time-consuming because of the 100 event cap. :(


     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @alleballe90

    I'm not able to reproduce this issue with the latest beta (5.6.0b11). Could you put together a sample project to reproduce this issue? That will help us test things on our end. If you could submit that with a support ticket, it would be greatly appreciated:
    https://analytics.cloud.unity3d.com/support/

    Are you seeing the data in your dashboard? It should show up there about 4 hours after you send you events.

    There are a couple of things I want to note:
    appStart should only show up once when you first start the app. appRunning will show up whenever the app gains or loses focus. That may explain why you only see appStart sporadically, though you should be seeing appRunning regularly.

    Looking at your code sample, you are actually send two separate Analytics events.

    Code (CSharp):
    1. public void CurrencySpent(){
    2.     Analytics.CustomEvent("inGameCurrencySpent", new Dictionary <string, object> {
    3.         { "coins", cSpent},
    4.         { "orbs", oSpent }
    5. }); // First Event
    6.     Debug.Log(Analytics.CustomEvent("inGameCurrencySpent"); //Second Event
    7. }
    We don't recommend sending events with the same name and different parameters. This can result in unintended behavior. It will also eat into your 100 event limit.

    How is your internet connectivity? We have had reports that the Validator may stop working after losing internet connection. (Restarting Unity will resolve that issue.)
     
  3. alleballe90

    alleballe90

    Joined:
    Jan 9, 2017
    Posts:
    7
    Yep my internet connection is horrible. Is there any work around?