Example #1
0
        public static AnalyticsResult CustomEvent(string customEventName, IDictionary <string, object> eventData)
        {
            if (string.IsNullOrEmpty(customEventName))
            {
                throw new ArgumentException("Cannot set custom event name to an empty or null string");
            }
            if (!IsInitialized())
            {
                return(AnalyticsResult.NotInitialized);
            }
            if (eventData == null)
            {
                return(SendCustomEventName(customEventName));
            }
            CustomEventData customEvent = new CustomEventData(customEventName);
            AnalyticsResult result      = AnalyticsResult.InvalidData;

            try
            {
                customEvent.AddDictionary(eventData);
                result = SendCustomEvent(customEvent);
            }
            finally
            {
                customEvent.Dispose();
            }
            return(result);
        }
Example #2
0
        public static AnalyticsResult CustomEvent(string customEventName, IDictionary <string, object> eventData)
        {
            if (string.IsNullOrEmpty(customEventName))
            {
                throw new ArgumentException("Cannot set custom event name to an empty or null string");
            }
            UnityAnalyticsHandler unityAnalyticsHandler = GetUnityAnalyticsHandler();

            if (unityAnalyticsHandler == null)
            {
                return(AnalyticsResult.NotInitialized);
            }
            if (eventData == null)
            {
                return(unityAnalyticsHandler.SendCustomEventName(customEventName));
            }
            CustomEventData customEvent = new CustomEventData(customEventName);

            customEvent.AddDictionary(eventData);
            return(unityAnalyticsHandler.SendCustomEvent(customEvent));
        }
Example #3
0
        public static AnalyticsResult CustomEvent(string customEventName, IDictionary <string, object> eventData)
        {
            bool flag = string.IsNullOrEmpty(customEventName);

            if (flag)
            {
                throw new ArgumentException("Cannot set custom event name to an empty or null string");
            }
            bool            flag2 = !Analytics.IsInitialized();
            AnalyticsResult result;

            if (flag2)
            {
                result = AnalyticsResult.NotInitialized;
            }
            else
            {
                bool flag3 = eventData == null;
                if (flag3)
                {
                    result = Analytics.SendCustomEventName(customEventName);
                }
                else
                {
                    CustomEventData customEventData = new CustomEventData(customEventName);
                    AnalyticsResult analyticsResult = AnalyticsResult.InvalidData;
                    try
                    {
                        customEventData.AddDictionary(eventData);
                        analyticsResult = Analytics.SendCustomEvent(customEventData);
                    }
                    finally
                    {
                        customEventData.Dispose();
                    }
                    result = analyticsResult;
                }
            }
            return(result);
        }