public FilterController(ISearchAndCompareApi api, IGeocoder geocoder, TelemetryClient telemetryClient, GoogleAnalyticsClient gaClient) { _api = api; _geocoder = geocoder; _telemetryClient = telemetryClient; _gaClient = gaClient; }
public void ProperlyFormedRequest() { var mockHttp = new Mock <IHttpClient>(); Uri resUri = null; StringContent resContent = null; mockHttp.Setup(x => x.PostAsync(It.IsAny <Uri>(), It.IsAny <StringContent>())) .Callback((Uri a, StringContent b) => { resUri = a; resContent = b; }) .ReturnsAsync(new HttpResponseMessage()); var sut = new GoogleAnalyticsClient(mockHttp.Object, "abc"); sut.TrackEvent("cid", "eventCategory", "eventAction", "eventLabel").Wait(); resUri.AbsoluteUri.Should().Be("https://www.google-analytics.com/collect"); var collection = HttpUtility.ParseQueryString(resContent.ReadAsStringAsync().Result); collection["v"].Should().Be("1"); collection["tid"].Should().Be("abc"); collection["cid"].Should().Be("cid"); collection["t"].Should().Be("event"); collection["ec"].Should().Be("eventCategory"); collection["ea"].Should().Be("eventAction"); collection["el"].Should().Be("eventLabel"); collection.Count.Should().Be(7); }
public App() { string profilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"GitBlame\Profile"); Directory.CreateDirectory(profilePath); ProfileOptimization.SetProfileRoot(profilePath); ProfileOptimization.StartProfile("Startup"); Log.DebugFormat("Starting new application; version {0}.", Assembly.GetExecutingAssembly().GetName().Version); m_analyticsClient = new GoogleAnalyticsClient("UA-25641987-2", "GitBlame", new GoogleAnalyticsStatisticsProvider()); #if !DEVELOPMENT BugSense.Init("w8cfcffb"); #endif AppDomain.CurrentDomain.UnhandledException += (s, ea) => { var exception = ea.ExceptionObject as Exception; if (exception != null) { Log.FatalFormat("Unhandled Exception: {0} {1}", exception, exception.GetType(), exception.Message); #if !DEVELOPMENT m_analyticsClient.SubmitExceptionAsync(exception, true); #endif } else { Log.FatalFormat("Unhandled Error: {0}", ea.ExceptionObject); } }; m_app = new AppModel(); }
public App() { // this doesn't appear to be configured automatically for WPF in .NET Core 3.0 RxApp.MainThreadScheduler = new DispatcherScheduler(); string profilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"GitBlame\Profile"); Directory.CreateDirectory(profilePath); ProfileOptimization.SetProfileRoot(profilePath); ProfileOptimization.StartProfile("Startup"); Log.Debug("Starting new application; version {0}.", Assembly.GetExecutingAssembly().GetName().Version); m_analyticsClient = new GoogleAnalyticsClient("UA-25641987-2", "GitBlame", new GoogleAnalyticsStatisticsProvider()); AppDomain.CurrentDomain.UnhandledException += (s, ea) => { if (ea.ExceptionObject is Exception exception) { Log.Fatal(exception, "Unhandled Exception: {0} {1}", exception.GetType(), exception.Message); #if !DEVELOPMENT m_analyticsClient.SubmitExceptionAsync(exception, true); #endif } else { Log.Fatal("Unhandled Error: {0}", ea.ExceptionObject); } }; m_app = new AppModel(); }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { if (Instance != null) { DestroyImmediate(gameObject); return; } else { Instance = this; DontDestroyOnLoad(gameObject); } name = "Google Analytics"; GenerateClientId(); cleint = new GoogleAnalyticsClient(_ClientId); if(!IsSessionStarted) { Client.CreateHit(GoogleAnalyticsHitType.SCREENVIEW); Client.StartSession(); Client.SetUserLanguage(Application.systemLanguage.ToString()); Client.SetScreenResolution(Screen.width, Screen.height); Client.Send(); IsSessionStarted = true; } SendFirstScreenHit(); SubmitSystemInfo(); if(GoogleAnalyticsSettings.Instance.AutoExceptionTracking) { #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 Application.RegisterLogCallback(HandleLog); #else Application.logMessageReceived += HandleLog; #endif } if(GoogleAnalyticsSettings.Instance.AutoCampaignTracking) { GA_AndroidTools.RequestReffer(); } #if UNITY_EDITOR if(GoogleAnalyticsSettings.Instance.UsePlayerSettingsForAppInfo) { GoogleAnalyticsSettings.Instance.AppName = PlayerSettings.productName; GoogleAnalyticsSettings.Instance.AppVersion = PlayerSettings.bundleVersion; } #endif }
public FilterController(ISearchAndCompareApi api, IGeocoder geocoder, TelemetryClient telemetryClient, GoogleAnalyticsClient gaClient, IRedirectUrlService redirectUrlService, IFeatureFlags featureFlags) { _api = api; _geocoder = geocoder; _telemetryClient = telemetryClient; _gaClient = gaClient; _redirectUrlService = redirectUrlService; _featureFlags = featureFlags; }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { if (Instance != null) { DestroyImmediate(gameObject); return; } else { Instance = this; DontDestroyOnLoad(gameObject); } GenerateClientId(); cleint = new GoogleAnalyticsClient(_ClientId); if (!IsSessionStarted) { Client.CreateHit(GoogleAnalyticsHitType.APPVIEW); Client.StartSession(); Client.SetUserLanguage(Application.systemLanguage.ToString()); Client.SetScreenResolution(Screen.width, Screen.height); Client.Send(); IsSessionStarted = true; } SendFirstScreenHit(); SubmitSystemInfo(); if (GoogleAnalyticsSettings.Instance.AutoExceptionTracking) { #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 Application.RegisterLogCallback(HandleLog); #else Application.logMessageReceived += HandleLog; #endif } #if UNITY_EDITOR if (GoogleAnalyticsSettings.Instance.UsePlayerSettingsForAppInfo) { GoogleAnalyticsSettings.Instance.AppName = PlayerSettings.productName; GoogleAnalyticsSettings.Instance.AppVersion = PlayerSettings.bundleVersion; } #endif }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { if (Instance != null) { DestroyImmediate(gameObject); return; } else { Instance = this; DontDestroyOnLoad(gameObject); } GenerateClientId(); cleint = new GoogleAnalyticsClient(_ClientId); if (!IsSessionStarted) { Client.StartSession(); Client.Send(); IsSessionStarted = true; } SendFirstScreenHit(); SubmitSystemInfo(); #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 Application.RegisterLogCallback(HandleLog); #else Application.logMessageReceived += HandleLog; #endif #if UNITY_EDITOR if (GoogleAnalyticsSettings.Instance.UsePlayerSettingsForAppInfo) { GoogleAnalyticsSettings.Instance.AppName = PlayerSettings.productName; GoogleAnalyticsSettings.Instance.AppVersion = PlayerSettings.bundleVersion; } #endif }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { if (Instance != null) { DestroyImmediate(gameObject); return; } else { Instance = this; DontDestroyOnLoad(gameObject); } GenerateClientId(); cleint = new GoogleAnalyticsClient(_ClientId); if(!IsSessionStarted) { Client.StartSession(); Client.Send(); IsSessionStarted = true; } SendFirstScreenHit(); SubmitSystemInfo(); if(GoogleAnalyticsSettings.Instance.AutoExceptionTracking) { #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 Application.RegisterLogCallback(HandleLog); #else Application.logMessageReceived += HandleLog; #endif } #if UNITY_EDITOR if(GoogleAnalyticsSettings.Instance.UsePlayerSettingsForAppInfo) { GoogleAnalyticsSettings.Instance.AppName = PlayerSettings.productName; GoogleAnalyticsSettings.Instance.AppVersion = PlayerSettings.bundleVersion; } #endif }