Ejemplo n.º 1
0
        internal static void SetTrackingTo(AnalyticsState state)
        {
            // No tracking for CI
            if (Application.isBatchMode)
            {
                return;
            }

            AnalyticsState currentState = GetTrackingState();

            if (state == AnalyticsState.Enabled && currentState != AnalyticsState.Enabled)
            {
                string id = EditorPrefs.GetString(BaseAnalyticsTracker.KeySessionId, null);
                if (string.IsNullOrEmpty(id))
                {
                    // Create new session id, which allows better tracking
                    EditorPrefs.SetString(BaseAnalyticsTracker.KeySessionId, Guid.NewGuid().ToString());
                }
            }

            if (currentState != state)
            {
                SendTrackingEvent(state);
                EditorPrefExtensions.SetEnum(KeyTrackingState, state);
            }
        }
Ejemplo n.º 2
0
        internal static AnalyticsState GetTrackingState()
        {
            // No tracking for CI
            if (Application.isBatchMode)
            {
                return(AnalyticsState.Disabled);
            }

            try
            {
                return(EditorPrefExtensions.GetEnum(KeyTrackingState, AnalyticsState.Unknown));
            }
            catch (ArgumentException)
            {
                EditorPrefExtensions.SetEnum(KeyTrackingState, AnalyticsState.Unknown);
                return(AnalyticsState.Unknown);
            }
        }