Skip to content

Commit 9380b1f

Browse files
authored
Merge pull request #244 from TelemetryDeck/feature/session-stats-option
Add option to disable the automatic tracking of session stats
2 parents 501270c + 99f8f62 commit 9380b1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/TelemetryDeck/TelemetryClient.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public final class TelemetryManagerConfiguration: @unchecked Sendable {
7373
/// Beginning a new session automatically sends a "TelemetryDeck.Session.started" Signal if `sendNewSessionBeganSignal` is `true`
7474
public var sessionID = UUID() {
7575
didSet {
76-
if #available(watchOS 7, *) {
76+
if #available(watchOS 7, *), self.sessionStatsEnabled {
7777
SessionManager.shared.startNewSession()
7878
}
7979

@@ -150,6 +150,11 @@ public final class TelemetryManagerConfiguration: @unchecked Sendable {
150150
/// - NOTE: Do not change this property if you're using our SDK in your app. This is for usage from other TelemetryDeck SDKs only.
151151
public var reservedParameterWarningsEnabled: Bool = true
152152

153+
/// If `true` the TelemetryDeck SDK will automatically track some basic session length and count statistics in a privacy-preserving manner for built-in insights. Defaults to `true`.
154+
///
155+
/// Can be used to manually opt-out of session tracking if for some reason you don't want us to write to UserDefaults once every second.
156+
public var sessionStatsEnabled: Bool = true
157+
153158
/// Log the current status to the signal cache to the console.
154159
@available(*, deprecated, message: "Please use the logHandler property instead")
155160
public var showDebugLogs: Bool = false

0 commit comments

Comments
 (0)