Skip to content

Commit f1b80ed

Browse files
committed
Users must opt into sessions
1 parent ba63a60 commit f1b80ed

File tree

6 files changed

+47
-6
lines changed

6 files changed

+47
-6
lines changed

Source/Platforms/Windows/ExceptionlessWindowsExtensions.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ public static class ExceptionlessWindowsExtensions {
1616
/// <param name="client">The ExceptionlessClient.</param>
1717
/// <param name="showDialog">Controls whether a dialog is shown when an unhandled exception occurs.</param>
1818
public static void Register(this ExceptionlessClient client, bool showDialog = true) {
19-
client.Configuration.UseSessions();
2019
client.Configuration.AddPlugin<SetEnvironmentUserPlugin>();
2120
client.Startup();
22-
client.SubmitSessionStart();
21+
22+
if (client.Configuration.SessionsEnabled)
23+
client.SubmitSessionStart();
24+
2325
client.RegisterApplicationThreadExceptionHandler();
2426

2527
// make sure that queued events are sent when the app exits
@@ -60,7 +62,9 @@ private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
6062
private static void RegisterOnProcessExitHandler(this ExceptionlessClient client) {
6163
if (_onProcessExit == null) {
6264
_onProcessExit = (sender, args) => {
63-
client.SubmitSessionEnd();
65+
if (client.Configuration.SessionsEnabled)
66+
client.SubmitSessionEnd();
67+
6468
client.ProcessQueue();
6569
};
6670
}

Source/Platforms/Windows/NuGet/readme.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ the following method.
4646

4747
exception.ToExceptionless().Submit()
4848

49+
-------------------------------------
50+
Session Tracking
51+
-------------------------------------
52+
Exceptionless can also track user sessions which enables powerful application analytics.
53+
54+
Session tracking can be enabled by simply adding this line to the startup of your application:
55+
56+
ExceptionlessClient.Default.Configuration.UseSessions()
57+
58+
You will also need to tell Exceptionless who the current user is in your application when the user logs in:
59+
60+
ExceptionlessClient.Default.Configuration.SetUserIdentity("UNIQUE_ID_OR_EMAIL_ADDRESS", "Display Name")
61+
4962
-------------------------------------
5063
Documentation and Support
5164
-------------------------------------

Source/Platforms/Wpf/ExceptionlessWpfExtensions.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ public static class ExceptionlessWpfExtensions {
1717
/// <param name="client">The ExceptionlessClient.</param>
1818
/// <param name="showDialog">Controls whether a dialog is shown when an unhandled exception occurs.</param>
1919
public static void Register(this ExceptionlessClient client, bool showDialog = true) {
20-
client.Configuration.UseSessions();
2120
client.Configuration.AddPlugin<SetEnvironmentUserPlugin>();
2221
client.Startup();
23-
client.SubmitSessionStart();
22+
23+
if (client.Configuration.SessionsEnabled)
24+
client.SubmitSessionStart();
25+
2426
client.RegisterApplicationThreadExceptionHandler();
2527
client.RegisterApplicationDispatcherUnhandledExceptionHandler();
2628

@@ -70,7 +72,9 @@ private static bool ShowDialog(EventSubmittingEventArgs e) {
7072
private static void RegisterOnProcessExitHandler(this ExceptionlessClient client) {
7173
if (_onProcessExit == null) {
7274
_onProcessExit = (sender, args) => {
73-
client.SubmitSessionEnd();
75+
if (client.Configuration.SessionsEnabled)
76+
client.SubmitSessionEnd();
77+
7478
client.ProcessQueue();
7579
};
7680
}

Source/Platforms/Wpf/NuGet/readme.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ the following method.
4545

4646
exception.ToExceptionless().Submit()
4747

48+
-------------------------------------
49+
Session Tracking
50+
-------------------------------------
51+
Exceptionless can also track user sessions which enables powerful application analytics.
52+
53+
Session tracking can be enabled by simply adding this line to the startup of your application:
54+
55+
ExceptionlessClient.Default.Configuration.UseSessions()
56+
57+
You will also need to tell Exceptionless who the current user is in your application when the user logs in:
58+
59+
ExceptionlessClient.Default.Configuration.SetUserIdentity("UNIQUE_ID_OR_EMAIL_ADDRESS", "Display Name")
60+
4861
-------------------------------------
4962
Documentation and Support
5063
-------------------------------------

Source/Shared/Configuration/ExceptionlessConfiguration.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ public string ApiKey {
137137
/// </value>
138138
public bool IncludePrivateInformation { get; set; }
139139

140+
/// <summary>
141+
/// Gets or sets a value indicating whether to automatically send session start, session heartbeats and session end events.
142+
/// </summary>
143+
public bool SessionsEnabled { get; set; }
144+
140145
/// <summary>
141146
/// Maximum number of events that should be sent to the server together in a batch. (Defaults to 50)
142147
/// </summary>

Source/Shared/Extensions/ExceptionlessConfigurationExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public static string GetInstallId(this ExceptionlessConfiguration config) {
8787
}
8888

8989
public static void UseSessions(this ExceptionlessConfiguration config, bool sendHeartbeats = true) {
90+
config.SessionsEnabled = true;
91+
9092
if (sendHeartbeats)
9193
config.AddPlugin<HeartbeatPlugin>();
9294
}

0 commit comments

Comments
 (0)