Skip to main content
Version: SDK 6.0.x

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 partner and channel.

You can access attribution data in your app through the JustTrackSDKBehaviour::GetAttribution method:

using JustTrack;

JustTrackSDKBehaviour.GetAttribution((attribution) => {
Debug.Log(attribution.Campaign.Name);
}, (error) => {
// handle error and wait for the attribution request to be retried automatically
});

If the attribution failed because we couldn't reach the justtrack backend (user might be offline), we will automatically retry it as soon as network connectivity is restored. In that case, you need to subscribe to the OnAttributionResponse callback to be notified about the attribution. Keep in mind that the callback can also be called if a user is attributed to a retargeting campaign.

using JustTrack;

JustTrackSDK.OnAttributionResponse += (attribution) => {
Debug.Log(attribution.Campaign.Name);
};

The attribution variable will be an instance of the AttributionResponse class. It looks like this:

namespace JustTrack {
public class AttributionResponse {
public string JusttrackUserId { get; }
public AttributionCampaign Campaign { get; }
public string UserType { get; }
public string Type { get; }
public AttributionChannel Channel { get; }
public AttributionPartner Partner { get; }
public string SourceId { get; }
public string SourceBundleId { get; }
public string SourcePlacement { get; }
public string AdsetId { get; }
public DateTime CreatedAt { get; }
}

public class AttributionCampaign {
public int Id { get; }
public string Name { get; }
public string Type { get; }
}

public class AttributionChannel {
public int Id { get; }
public string Name { get; }
public bool Incent { get; }
}

public class AttributionPartner {
public int Id { get; }
public string Name { get; }
}
}