Esempio n. 1
0
 private void PostData(string uri)
 {
     if (AnalyticsUtils.GetTrackingState() == AnalyticsState.Enabled)
     {
         client.GetAsync(uri);
     }
 }
Esempio n. 2
0
        static AnalyticsSetup()
        {
            AnalyticsState trackingState = AnalyticsUtils.GetTrackingState();

            if (trackingState == AnalyticsState.Disabled)
            {
                return;
            }
            // Can be used by ci to deactivate tracking.
            if (Environment.GetCommandLineArgs().Contains("-no-tracking"))
            {
                AnalyticsUtils.SetTrackingTo(AnalyticsState.Disabled);
                return;
            }

            if (trackingState == AnalyticsState.Unknown)
            {
                SetupTrackingPopup.Open();
                AnalyticsUtils.SetTrackingTo(AnalyticsState.Enabled);
                return;
            }

            // Only run once a day.
            if (DateTime.Today.Ticks.ToString().Equals(EditorPrefs.GetString(KeyLastDayActive, null)) == false)
            {
                EditorPrefs.SetString(KeyLastDayActive, DateTime.Today.Ticks.ToString());
                IAnalyticsTracker tracker = AnalyticsUtils.CreateTracker();

                tracker.SendSessionStart();
                // Send the Unity Editor version.
                tracker.Send(new AnalyticsEvent()
                {
                    Category = "unity", Action = "version", Label = Application.unityVersion
                });
                // Send the Creator Core version.
                tracker.Send(new AnalyticsEvent()
                {
                    Category = "creator", Action = "version", Label = EditorUtils.GetCoreVersion()
                });
                // Send the Creator license type.
#if CREATOR_PRO
                tracker.Send(new AnalyticsEvent()
                {
                    Category = "creator", Action = "license", Label = UserAccount.IsCustomer() ? "customer" : "trial"
                });
#else
                tracker.Send(new AnalyticsEvent()
                {
                    Category = "creator", Action = "license", Label = "free"
                });
#endif
            }
        }