Search Unity

Why removing the Validator ?

Discussion in 'Unity Analytics' started by LortedoO, Mar 30, 2020.

  1. LortedoO

    LortedoO

    Joined:
    May 26, 2018
    Posts:
    7
    Hello everyone!

    I was wondering why do Unity remove the Validator.
    Debugging analytics is a plague!

    Have you any method to efficiency debug event triggering, please?

    Thanks!
     
  2. LortedoO

    LortedoO

    Joined:
    May 26, 2018
    Posts:
    7
    Hi!

    In order to replace this validator, I have made a little script that logs a message in console on analytics send.

    Here's the code:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Analytics;
    5.  
    6. public static class ExtendedAnalytics
    7. {
    8.     public static void SendEvent(string eventName, IDictionary<string, object> eventData = null)
    9.     {
    10.         var result = AnalyticsEvent.Custom(eventName, eventData);
    11.  
    12. #if UNITY_EDITOR
    13.         Debug.LogFormat("<color=red>Analytics</color> # Event <color=green>{0}</color> fired with result {1}. (param: {2})", eventName, result, eventData != null ? eventData.ToDebugString() : "NONE");
    14. #endif
    15.     }
    16. }
     
    SamOYUnity3D likes this.
  3. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    You can also try the following two ways to confirm if you are sending Analytics Events.

    1. Surround your Analytics.CustomEvent with a Debug.Log, like this: Debug.Log(Analytics.CustomEvent());
    This should print "Ok" in the console if the events are sending. Otherwise, it will give you an error message.
    https://docs.unity3d.com/ScriptReference/Analytics.AnalyticsResult.html

    2. Use a network traffic analyzer, such as Charles Proxy:
    https://www.charlesproxy.com/
    https://support.unity3d.com/hc/en-us/articles/115002917683-Using-Charles-Proxy-with-Unity
     
    LortedoO likes this.
  4. LortedoO

    LortedoO

    Joined:
    May 26, 2018
    Posts:
    7
    Thank you Sam !