Set up the SDK
The justtrack SDK offers extensive tracking capabilities for attribution, events, and various other functionalities within your iOS application. In this guide, you'll learn to:
- Add the justtrack SDK to your app
- Copy your API token
- Instantiate a JustTrackSdk object
- Shutdown the SDK instance
Add the SDK
CocoaPods
You can use CocoaPods to add the justtrack SDK to your app. Add the following line to your Podfile
:
pod 'JustTrackSDK', '4.7.0'
Afterwards, run pod install
in your project to actually download and install the justtrack SDK for your project.
Carthage
This feature is introduced in version 4.5.2
You can also use Carthage. Add the following line to your Cartfile
:
binary "https://sdk.justtrack.io/carthage/JustTrackSDK.json" == 4.7.0
Afterwards, run carthage update
inside the project directory to download the justtrack SDK for your project.
Swift Package Manager
This feature is introduced in version 4.5.2
The SDK is available via Swift Package Manager. To add the SDK package to your Xcode project, select File > Add Package Dependency and enter its repository URL https://github.com/justtrackio/justtrack-sdk-spm
.
We support Xcode version 14.0 and later.
Copy your API token
Before integrating the justtrack SDK into your app, you need to obtain an API token. Follow our guide to find your token.
Instantiate the SDK
The SDK consists of a handful of (public) classes and protocols you can interact with. The main protocol of these is JustTrackSdk
which allows you to attribute the current user, send notifications to the backend or record user events. To create an instance of the SDK you have to invoke the JustTrackSdkBuilder
class. Instantiating the SDK could look like this:
do {
let sdk = try JustTrackSdkBuilder(apiToken: "prod-...").build()
} catch {
// apiToken has invalid format...
}