Get attribution info
The justtrack SDK automatically determines a user’s identity and attribution after setup. This includes details about the ad the user clicked (if any), the campaign that ad belongs to, and the associated network and channel.
You can access attribution data in your app through the JustTrackSdk::attribution
field:
sdk.attribution.observe { result in
switch result {
case let .failure(error):
// handle error
case let .success(response):
log(response.campaign.name)
}
}
If you are only using the justtrack dashboard to keep track of your install sources, you can ignore the result of attribution
in your app. To get the information about the user attribution in your app you need to call observe
on the future returned by attribution
. This will call the provided callback with the Result
of the attribution of the user.
If the attribution can not be performed because the user is offline, it will eventually fail. The SDK will then wait for a new internet connection and retry the attribution. An attribution obtained after the returned Future
resolved to a failure value won't update the future. You have to subscribe to updates of the attribution using register(attributionListener:)
to receive the attribution.