From 2b6e821c9e594deb436c44e194513c6c93339d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 1 Nov 2024 11:11:54 +0100 Subject: [PATCH] Add section documenting all default global options in the Swift SDK --- guides/swift-setup.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/guides/swift-setup.md b/guides/swift-setup.md index df5280a..267c9e6 100644 --- a/guides/swift-setup.md +++ b/guides/swift-setup.md @@ -205,6 +205,29 @@ And you're done! You are now sending signals to the TelemetryDeck server. 🎉 Run your app and confirm that your first signal arrived in the "Recent Signals" tab on TelemetryDeck. Don't forget to turn on "Test Mode" to see signals sent in debug builds! +## Configuring Default Signal Properties (Optional) + +When initializing TelemetryDeck, you can configure some defaults to help keep your signals organized and consistent: + +```swift +let config = TelemetryDeck.Config(appID: "YOUR-APP-ID") + +// Add a prefix to all signal names +config.defaultSignalPrefix = "App." +// With this set, calling signal("launched") will actually send "App.launched" + +// Add a prefix to all parameter names +config.defaultParameterPrefix = "MyApp." +// This prefixes all keys in your parameters dictionary + +// Set parameters that will be included with every signal +config.defaultParameters = {[ + "theme": UserDefaults.standard.string(forKey: "theme") ?? "default", + "isPayingUser": FreemiumKit.shared.hasPurchased ? "true" : "false", +]} +// These parameters will be merged with any additional parameters you specify in signal() calls +``` + ## Fill out Apple's app privacy details Something you need to do before you can upload your app to the App Store is going through Apple's privacy details on App Store Connect. This informs your users about what data is collected, and how it is collected.