diff --git a/Source/Platforms/Windows/ExceptionlessWindowsExtensions.cs b/Source/Platforms/Windows/ExceptionlessWindowsExtensions.cs index 099d78ab..e98d38d7 100644 --- a/Source/Platforms/Windows/ExceptionlessWindowsExtensions.cs +++ b/Source/Platforms/Windows/ExceptionlessWindowsExtensions.cs @@ -16,10 +16,12 @@ public static class ExceptionlessWindowsExtensions { /// The ExceptionlessClient. /// Controls whether a dialog is shown when an unhandled exception occurs. public static void Register(this ExceptionlessClient client, bool showDialog = true) { - client.Configuration.UseSessions(); client.Configuration.AddPlugin(); client.Startup(); - client.SubmitSessionStart(); + + if (client.Configuration.SessionsEnabled) + client.SubmitSessionStart(); + client.RegisterApplicationThreadExceptionHandler(); // make sure that queued events are sent when the app exits @@ -60,7 +62,9 @@ private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e) private static void RegisterOnProcessExitHandler(this ExceptionlessClient client) { if (_onProcessExit == null) { _onProcessExit = (sender, args) => { - client.SubmitSessionEnd(); + if (client.Configuration.SessionsEnabled) + client.SubmitSessionEnd(); + client.ProcessQueue(); }; } diff --git a/Source/Platforms/Windows/NuGet/readme.txt b/Source/Platforms/Windows/NuGet/readme.txt index 1a2fc1b9..87fe7332 100644 --- a/Source/Platforms/Windows/NuGet/readme.txt +++ b/Source/Platforms/Windows/NuGet/readme.txt @@ -46,6 +46,19 @@ the following method. exception.ToExceptionless().Submit() +------------------------------------- + Session Tracking +------------------------------------- +Exceptionless can also track user sessions which enables powerful application analytics. + +Session tracking can be enabled by simply adding this line to the startup of your application: + +ExceptionlessClient.Default.Configuration.UseSessions() + +You will also need to tell Exceptionless who the current user is in your application when the user logs in: + +ExceptionlessClient.Default.Configuration.SetUserIdentity("UNIQUE_ID_OR_EMAIL_ADDRESS", "Display Name") + ------------------------------------- Documentation and Support ------------------------------------- diff --git a/Source/Platforms/Wpf/ExceptionlessWpfExtensions.cs b/Source/Platforms/Wpf/ExceptionlessWpfExtensions.cs index bd6df24c..7c4c0508 100644 --- a/Source/Platforms/Wpf/ExceptionlessWpfExtensions.cs +++ b/Source/Platforms/Wpf/ExceptionlessWpfExtensions.cs @@ -17,10 +17,12 @@ public static class ExceptionlessWpfExtensions { /// The ExceptionlessClient. /// Controls whether a dialog is shown when an unhandled exception occurs. public static void Register(this ExceptionlessClient client, bool showDialog = true) { - client.Configuration.UseSessions(); client.Configuration.AddPlugin(); client.Startup(); - client.SubmitSessionStart(); + + if (client.Configuration.SessionsEnabled) + client.SubmitSessionStart(); + client.RegisterApplicationThreadExceptionHandler(); client.RegisterApplicationDispatcherUnhandledExceptionHandler(); @@ -70,7 +72,9 @@ private static bool ShowDialog(EventSubmittingEventArgs e) { private static void RegisterOnProcessExitHandler(this ExceptionlessClient client) { if (_onProcessExit == null) { _onProcessExit = (sender, args) => { - client.SubmitSessionEnd(); + if (client.Configuration.SessionsEnabled) + client.SubmitSessionEnd(); + client.ProcessQueue(); }; } diff --git a/Source/Platforms/Wpf/NuGet/readme.txt b/Source/Platforms/Wpf/NuGet/readme.txt index 93d7b95e..cdc2fa36 100644 --- a/Source/Platforms/Wpf/NuGet/readme.txt +++ b/Source/Platforms/Wpf/NuGet/readme.txt @@ -45,6 +45,19 @@ the following method. exception.ToExceptionless().Submit() +------------------------------------- + Session Tracking +------------------------------------- +Exceptionless can also track user sessions which enables powerful application analytics. + +Session tracking can be enabled by simply adding this line to the startup of your application: + +ExceptionlessClient.Default.Configuration.UseSessions() + +You will also need to tell Exceptionless who the current user is in your application when the user logs in: + +ExceptionlessClient.Default.Configuration.SetUserIdentity("UNIQUE_ID_OR_EMAIL_ADDRESS", "Display Name") + ------------------------------------- Documentation and Support ------------------------------------- diff --git a/Source/Shared/Configuration/ExceptionlessConfiguration.cs b/Source/Shared/Configuration/ExceptionlessConfiguration.cs index 665d6084..4965ae17 100644 --- a/Source/Shared/Configuration/ExceptionlessConfiguration.cs +++ b/Source/Shared/Configuration/ExceptionlessConfiguration.cs @@ -137,6 +137,11 @@ public string ApiKey { /// public bool IncludePrivateInformation { get; set; } + /// + /// Gets or sets a value indicating whether to automatically send session start, session heartbeats and session end events. + /// + public bool SessionsEnabled { get; set; } + /// /// Maximum number of events that should be sent to the server together in a batch. (Defaults to 50) /// diff --git a/Source/Shared/Extensions/ExceptionlessConfigurationExtensions.cs b/Source/Shared/Extensions/ExceptionlessConfigurationExtensions.cs index 58b73b85..d6b65fb0 100644 --- a/Source/Shared/Extensions/ExceptionlessConfigurationExtensions.cs +++ b/Source/Shared/Extensions/ExceptionlessConfigurationExtensions.cs @@ -87,6 +87,8 @@ public static string GetInstallId(this ExceptionlessConfiguration config) { } public static void UseSessions(this ExceptionlessConfiguration config, bool sendHeartbeats = true) { + config.SessionsEnabled = true; + if (sendHeartbeats) config.AddPlugin(); }