Attribution

The SDK accepts attribution data from several sources: a media source descriptor, Adjust device ID, Firebase App Instance ID, and a referrer identifier. Providing this data before calling initialSetup() ensures that the first configuration fetch is correctly attributed.

Media source

mediaSource carries the network, campaign, and ad group that brought the user to your app. Magify uses this information for campaign targeting and analytics segmentation.

var mediaSource: MediaSource

MediaSource is a data class with three nullable string fields:

data class MediaSource(
    val network: String? = null,
    val campaign: String? = null,
    val adGroup: String? = null
)

Set the media source after receiving attribution data from your MMP:

magify.mediaSource = MediaSource(
    network = "facebook_ads",
    campaign = "summer_promo",
    adGroup = "us_women_25_34"
)

Assigning the same value that is already stored is a no-op; the SDK only triggers a configuration reload when the value changes.

Adjust

If your app uses the Adjust SDK, pass the Adjust device identifier so Magify can correlate events with Adjust attribution data:

var adjustId: String?
magify.adjustId = Adjust.getAdid()

Setting a new non-null, non-empty value resets the authorization token and fetches a fresh one. Setting the same value that is already stored is a no-op.

Firebase

If your app uses Firebase Analytics, pass the Firebase App Instance ID to enable cross-platform user stitching:

var firebaseAppInstanceId: String?
FirebaseAnalytics.getInstance(context).appInstanceId.addOnSuccessListener { id ->
    magify.firebaseAppInstanceId = id
}

Setting a new value triggers a Firebase mapping event in Magify analytics.

Referrer

The referrer identifier links a user to a specific referral or deep-link source. Magify uses it for campaign targeting.

var referrerId: String?
magify.referrerId = "invite_abc123"

Observe referrer changes using RxJava2:

magify.observeReferrerChanged()
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe {
        // React to the updated referrer.
    }

Attribution and client identity

All attribution fields are associated with the SDK's clientId. To tie attribution data from a third-party MMP to the same user, set the Magify clientId as the customer user ID in that MMP before initializing it.

For integration patterns with AppsFlyer, Adjust, and other providers, refer to the Integration with other SDKs page.

Related articles

UnityPurchasing

Analytics

Conversion Tracking

Campaigns

Your own integration

Content