Get attribution info
Platform:
Version:
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::getAttribution method:
- Android
- iOS
- Unity
- React Native
- Flutter
- Godot
val attribution = sdk.attribution.await()
val userType = attribution.userType
val campaign = attribution.campaign
val campaignName = campaign.name
val campaignId = campaign.id
val campaignType = campaign.type
val campaignIsOrganic = campaign.isOrganic
val type = attribution.type
val channel = attribution.channel
val channelName = channel.name
val channelId = channel.id
val channelIsIncent = channel.isIncent
val partner = attribution.partner
val partnerName = partner.name
val partnerId = partner.id
val sourceId = attribution.sourceId
val sourceBundleId = attribution.sourceBundleId
val sourcePlacement = attribution.sourcePlacement
val adsetId = attribution.adsetId
val createdAt = attribution.createdAt
val isRedownload = attribution.isRedownload
sdk.attribution.observe { result in
switch result {
case let .failure(error):
// handle error
case let .success(response):
let userType = response.userType
let isRedownload = response.isRedownload
let campaign = response.campaign
let campaignName = campaign.name
let campaignId = campaign.id
let campaignType = campaign.type
let campaignIsOrganic =campaign.isOrganic
let type = response.type
let channel = response.channel
let channelName = channel.name
let channelId = channel.id
let channelIsIncent = channel.isIncent
let partner = response.partner
let partnerName = partner.name
let partnerId = partner.id
let sourceId = response.sourceId
let sourceBundleId = response.sourceBundleId
let sourcePlacement = response.sourcePlacement
let adsetId = response.adsetId
let createdAt = response.createdAt
}
}
using JustTrack;
JustTrackSDKBehaviour.GetAttribution((attribution) => {
var campaign = attribution.Campaign;
var campaignName = campaign.Name;
var campaignId = campaign.Id;
var campaignType = campaign.Type;
var userType = attribution.UserType;
var type = attribution.Type;
var channel = attribution.Channel;
var channelName = channel.Name;
var channelId = channel.Id;
var channelIsIncent = channel.IsIncent;
var partner = attribution.Partner;
var partnerName = partner.Name;
var partnerId = partner.Id;
var sourceId = attribution.SourceId;
var sourceBundleId = attribution.SourceBundleId;
var sourcePlacement = attribution.SourcePlacement;
var adsetId = attribution.AdsetId;
var createdAt = attribution.CreatedAt;
}, (error) => {
// handle error and wait for the attribution request to be retried automatically
});
const attribution = await JustTrackSdk.getAttribution();
const userType = attribution.userType;
const type = attribution.type;
const campaign = attribution.campaign;
const campaignName = campaign.name;
const campaignId = campaign.id;
const campaignType = campaign.type;
const campaignIsOrganic = campaign.isOrganic;
const partner = attribution.partner;
const partnerName = partner.name;
const partnerId = partner.id;
const channel = attribution.channel;
const channelName = channel.name;
const channelId = channel.Id;
const channelIsIncent = channel.isIncent;
const sourceId = attribution.sourceId;
const sourceBundleId = attribution.sourceBundleId;
const sourcePlacement = attribution.sourcePlacement;
const adsetId = attribution.adsetId;
const isRedownload = attribution.isRedownload;
final attribution = await JusttrackSdk.getAttribution();
final userType = attribution.userType;
final type = attribution.type;
final campaign = attribution.campaign;
final campaignName = campaign.name;
final campaignId = campaign.id;
final campaignType = campaign.type;
final campaignIsOrganic = campaign.isOrganic;
final channel = attribution.channel;
final channelName = channel.name;
final channelId = channel.id;
final partner = attribution.partner;
final partnerName = partner.name;
final partnerId = partner.id;
final sourceId = attribution.sourceId;
final sourceBundleId = attribution.sourceBundleId;
final sourcePlacement = attribution.sourcePlacement;
final adsetId = attribution.adsetId;
final createdAt = attribution.createdAt;
final isRedownload = attribution.isRedownload;
func _ready() -> void:
JustTrackSdk.attribution_received.connect(_on_attribution)
JustTrackSdk.attribution_failed.connect(_on_attribution_failed)
JustTrackSdk.get_attribution()
func _on_attribution(attribution: Dictionary) -> void:
var userType = attribution.get("userType")
var type = attribution.get("type")
var isRedownload = attribution.get("isRedownload")
var createdAt = attribution.get("createdAt")
var campaign = attribution.get("campaign") as Dictionary
var campaignId = campaign.get("id")
var campaignName = campaign.get("name")
var campaignType = campaign.get("type")
var campaignIsOrganic = campaign.get("isOrganic")
var channel = attribution.get("channel") as Dictionary
var channelId = channel.get("id")
var channelName = channel.get("name")
var channelIsIncent = channel.get("isIncent")
var partner = attribution.get("partner") as Dictionary
var partnerId = partner.get("id")
var partnerName = partner.get("name")
var sourceId = attribution.get("sourceId")
var sourceBundleId = attribution.get("sourceBundleId")
var sourcePlacement = attribution.get("sourcePlacement")
var adsetId = attribution.get("adsetId")
func _on_attribution_failed(code: String, message: String) -> void:
push_error("Attribution failed [%s]: %s" % [code, message])
If you are only using the justtrack dashboard to keep track of your install sources, you don't need to call getAttribution yourself.