Skip to main content
Version: SDK 5.0.x

JustTrackSdk

public protocol JustTrackSdk : AnyObject

testGroupId

The test group of a user is an integer from the set [1, 2, 3]. If might be nil on non-standard devices.

var testGroupId: Int? { get }

attribution

This future eventually resolves to the latest attribution response for the user. If the attribution of a user changes, a different future with the updated attribution will be provided.

var attribution: Future<AttributionResponse> { get }

retargetingParameters

Resolves to the retargeting parameters from the attribution response (if the user was attributed to a retargeting campaign).

var retargetingParameters: Future<RetargetingParameters?> { get }

preliminaryRetargetingParameters

Contains the preliminary retargeting parameters (should we already know that the user will most likely get attributed to a retargeting campaign, but this wasn’t validated with the justtrack backend yet).

var preliminaryRetargetingParameters: PreliminaryRetargetingParameters? { get }

appVersionAtInstall

Returns the version of the app at the time the app was installed.

var appVersionAtInstall: AppVersion { get }

sdkVersion

Contains the current version of the justtrack SDK used by your app.

var sdkVersion: any Version { get }

anonymize()

Anonymize a user’s installs, events, and sessions.

Instruct the justtrack backend to delete identifying information about the user.

func anonymize() -> Future<Void>

Return Value

A future which resolves as soon as the backend was notified.

isRunning()

Returns true if the SDK instance is running, otherwise returns false.

func isRunning() -> Bool

register(attributionListener:)

Register a listener to get notified about changes to the attribution of a user (an attribution can change shortly after the app install or when the user returns to the app via a retargeting campaign).

func register(attributionListener: @escaping (AttributionResponse) -> Void) -> Subscription

register(retargetingParametersListener:)

Register a listener to get notified about changes to the retargeting parameters.

func register(retargetingParametersListener: @escaping (RetargetingParameters) -> Void) -> Subscription

register(preliminaryRetargetingParametersListener:)

Register a listener to get notified about changes to the preliminary retargeting parameters.

func register(preliminaryRetargetingParametersListener: @escaping (PreliminaryRetargetingParameters) -> Void) -> Subscription

shutdown()

Shutdown the justtrack SDK and stop all running processes of the SDK. You mustn’t call any methods on the SDK after shutting it down.

func shutdown()

Create an affiliate link to recruit new users to your app with the current user being the recruiting user.

@available(*, deprecated, message: "The method is deprecated.")
func createAffiliateLink() -> Future<String>

createAffiliateLink(channel:)

Create an affiliate link to recruit new users to your app with the current user being the recruiting user while providing an optional channel attribute. The channel allows you to distinguish different parts of your app for the newly recruited users.

@available(*, deprecated, message: "The method is deprecated.")
func createAffiliateLink(channel: String) -> Future<String>

set(userId:)

Set a user id from your own backend and forward it to the justtrack backend. This allows you to provide server-side events while using your own identifier for a user. Returns a future which resolves as soon as your user ID has reached the justtrack backend.

This method already handles deduplicating requests, thus calling this method (also over different executions of your app) is idempotent.

func set(userId: String) -> Future<Void>

set(firebaseAppInstanceId:)

Set the Firebase App Instance ID for the current user. This is only needed if you don’t use the automatic integration with Firebase. Forwards the App Instance ID to the justtrack backend, making it available for sending postbacks to Firebase from backend side.

This method contains the same deduplication and retry logic like set(customUserId:).

func set(firebaseAppInstanceId: String) -> Future<Void>

set(automaticInAppPurchaseTracking:)

Configure automatic in-app purchase forwarding to the justtrack backend for the execution of the app. By default, the justtrack SDK forwards in-app purchases to the justtrack backend to track the revenue generated by a user. You can use this method to opt out of this behavior.

func set(automaticInAppPurchaseTracking: Bool)

start()

Starts the SDK.

The SDK starts tracking the user only after the start method is called. User’s unique IDs, install and app events will only be tracked after the method is used. Any event preceding the start call will not be reported by the SDK.

func start()

stop()

After this API is called, the SDK will no longer send any data to the justtrack servers.

The SDK stops tracking the user entirely. No ID’s or app events will be tracked or reported. Any app events collected before the stop method is called will still be reported.

func stop()

publish(event:)

Track an event from your user (like performing some task, clicking some button, reaching some goal, …) and send it to the justtrack backend. User events allow you to track users through the funnel of your app and can be analyzed on the justtrack dashboard.

The returned future resolves once the event has been sent to the server. If network conditions don’t allow sending the event right now it will be sent to the backend later once connectivity improves.

func publish(event: AppEvent) -> Future<Void>

forward(adImpression:)

Forward an ad impression and count the revenue generated from the impression for your app (if you provided a revenue value). Returns false if any provided parameter was considered invalid.

func forward(adImpression: AdImpression) -> Result<Void, Error>

getJusttrackUserId()

Returns justtrack user ID allows you to identify a user and stays the same at least until your app is uninstalled.

@available(*, deprecated, message: "This method is deprecated.")
func getJusttrackUserId() -> Future<String>

getInstallInstanceId()

Returns the unique id of the current install of the user.

func getInstallInstanceId() -> Future<String>

getAdvertiserIdInfo()

Returns the used advertiser ID (IDFA) and whether the user limited ad tracking.

func getAdvertiserIdInfo() -> Future<AdvertiserIdInfo>

integrateWithAdColony()

Automatically forward impressions from AdColony to the justtrack backend.

func integrateWithAdColony() -> Result<Void, Error>

integrateWithAppLovin(...)

Automatically forward impressions from AppLovin to the justtrack backend.

func integrateWithAppLovin(userIdSource: UserIdSource, listenFor: AppLovinAdEvent) -> Result<Void, Error>

integrateWithChartboost()

Automatically forward impressions from Chartboost to the justtrack backend.

func integrateWithChartboost() -> Result<Void, Error>

integrateWithFirebase()

Automatically publish the Firebase App Instance ID to the justtrack backend.

func integrateWithFirebase() -> Result<Void, Error>

integrateWithIronSource(customUserId:)

Integrate with the IronSource SDK, setting the provided custom user ID as their user ID. You have to call this method before calling IronSource.init(appKey:).

func integrateWithIronSource(customUserId: String) -> Result<Void, Error>

integrateWithIronSource(userIdSource:)

Integrate with the IronSource SDK, setting either the justtrack user ID as their user ID or no user id at all. Not setting a user ID might make sense if you are already setting one yourself and have the initialization logic separate from the logic setting up the justtrack SDK. You have to call this method before calling IronSource.init(appKey:).

func integrateWithIronSource(userIdSource: UserIdSource) -> Result<Void, Error>

integrateWithUnityAds()

Automatically forward impressions from Unity Ads to the justtrack backend.

func integrateWithUnityAds() -> Result<Void, Error>

forward(transaction:)

Forwards StoreKit 2 transactions for in-app purchases and subscriptions from your app to the justtrack backend.

@available(iOS 15.0, *)
func forward(transaction: Transaction) -> Result<Void, Error>

forward(...)

Forwards StoreKit 2 transaction id, product id, and quantity for in-app purchases and subscriptions from your app to the justtrack backend.

@available(iOS 15.0, *)
func forward(transactionId: String, productId: String, quantity: Int) -> Result<Void, Error>