Complete reference for the configuration options available in the RudderStack Swift SDK.
3 minute read
The RudderStack Swift SDK provides various configuration options to customize its behavior according to your requirements. This guide covers all the available configuration options and their usage.
Configuration class
The Configuration class is used to initialize the SDK in your Apple platform application. It defines the required parameters and optional configuration settings to customize the SDK behavior.
SDK configuration options
Parameter
Type
Description
writeKey Required
String
The source write key obtained from the RudderStack dashboard used for authentication.
dataPlaneUrl Required
String
The URL of your RudderStack data plane (backend) where the events are sent.
Configuration settings for managing user sessions.
See Session Tracking for more information on session management in the Swift SDK.
See Session configuration for more information on the session configuration options and their default values.
Session configuration
The SessionConfiguration class provides the following parameters to customize session management:
Parameter
Type
Description
automaticSessionTracking
Boolean
Enables automatic session tracking.
Default value:true
sessionTimeoutInMillis
UInt64
Sets the timeout duration for automatic session tracking in milliseconds. It is the time between the app closed or backgrounded to being foregrounded or relaunched again.
The SDK times out a session and starts a new session after this time has elapsed.
Default value:300000 (5 minutes)
Device ID collection
When you enable collectDeviceId, the SDK retrieves a unique device ID and includes it in the event payload under the device.id field in the event’s context object.
In the iOS, watchOS, and tvOS platforms, the SDK uses the device’s identifierForVendor field. In macOS, it derives the ID from the device’s MAC address.
If the SDK retrieves an empty or invalid value for the device ID, it will not include the device.id field in the event payload’s context.
Request compression
When you set gzipEnabled to true, all /batch requests sent by the SDK will have their payloads compressed using Gzip compression, thereby reducing the size of the network requests.
Sample SDK initialization
The following snippet demonstrates how to initialize the Swift SDK with the supported configuration options:
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.