/// <summary> /// Static constructor permits a once-on-load analytics collection event. /// </summary> static ARCoreAnalytics() { // Create the new instance. Instance = new ARCoreAnalytics(); Instance.Load(); // Send analytics immediately. Instance.SendAnalytics(_googleAnalyticsHost, LogRequestUtils.BuildLogRequest(), false); // Use the Editor Update callback to monitor the communication to the server. EditorApplication.update += new EditorApplication.CallbackFunction(Instance.OnAnalyticsUpdate); }
/// <summary> /// Periodically checks back to update the current logging request, or if /// enough time has passed, initiate a new logging request. /// </summary> private void OnAnalyticsUpdate() { // Nothing to do if Analytics isn't enabled. if (EnableAnalytics == false) { return; } // Process the current web request. if (_webRequest != null) { if (_webRequest.isDone == true) { if (_verbose == true) { #if UNITY_2020_2_OR_NEWER if (_webRequest.result == UnityWebRequest.Result.ConnectionError) #else if (_webRequest.isNetworkError == true) #endif { Debug.Log("Error sending Google ARCore SDK for Unity analytics: " + _webRequest.error); } else { Debug.Log("Google ARCore SDK for Unity analytics sent: " + _webRequest.downloadHandler.text); } } _webRequest = null; } } // Resend analytics periodically (once per week if the editor remains open.) if (DateTime.Now.Ticks - _lastUpdateTicks >= _analyticsResendDelayTicks) { Instance.SendAnalytics( _googleAnalyticsHost, LogRequestUtils.BuildLogRequest(), false); } }
/// <summary> /// Periodically checks back to update the current logging request, or if /// enough time has passed, initiate a new logging request. /// </summary> private void _OnAnalyticsUpdate() { // Nothing to do if Analytics isn't enabled. if (EnableAnalytics == false) { return; } // Process the current web request. if (m_WebRequest != null) { if (m_WebRequest.isDone == true) { if (m_Verbose == true) { if (m_WebRequest.isNetworkError == true) { Debug.Log("Error sending Google ARCore SDK for Unity analytics: " + m_WebRequest.error); } else { Debug.Log("Google ARCore SDK for Unity analytics sent: " + m_WebRequest.downloadHandler.text); } } m_WebRequest = null; } } // Resend analytics periodically (once per week if the editor remains open.) if (DateTime.Now.Ticks - m_LastUpdateTicks >= k_AnalyticsResendDelayTicks) { Instance.SendAnalytics( k_GoogleAnalyticsHost, LogRequestUtils.BuildLogRequest(), false); } }
/// <summary> /// Periodically checks back to update the current logging request, or if /// enough time has passed, initiate a new logging request. /// </summary> public void OnAnalyticsUpdate() { // Nothing to do if Analytics isn't enabled. if (EnableAnalytics == false) { return; } // Process the current web request. if (_webRequest != null) { if (_webRequest.isDone == true) { _webRequest = null; } } // Resend analytics periodically (once per week if the editor remains open.) if (DateTime.Now.Ticks - _lastUpdateTicks >= _analyticsResendDelayTicks) { Instance.SendAnalytics( _googleAnalyticsHost, LogRequestUtils.BuildLogRequest()); } }