Launch offer for the first 500 accounts: $10K MTR free for 24 months + $100 credit →
    .io

    Attribution Integrations

    See it in the demo — See which channels actually pay (~60s)

    Overview

    The attribution setters store each provider’s identifier on the BillDog customer. The values are merged field by field (nil never overwrites an existing ID) and come back in the customer’s attribution data. Storing an ID doesn’t by itself send anything to that provider. Of the providers below, Adjust and AppsFlyer receive subscription events from BillDog’s servers once you connect them, and each connector reads the stored ID: Adjust sends it as adid alongside any device identifiers, and AppsFlyer needs it to attribute an event at all (see Server-to-server forwarding).

    The setters are wired identically on iOS and Android and produce a single set-customer-attribution call to the BillDog API per change.

    Supported providers

    Method names are identical on both platforms. Call them on BillDog.shared (iOS) or BillDog.getInstance() (Android). Every setter is async on iOS and a suspend function returning Result<Unit> on Android, so it must be called from an async context.

    ProviderSDK methodAttribution key
    AdjustsetAdjustIdadjustId
    AppsFlyersetAppsflyerIdappsflyerId
    BranchsetBranchIdbranchId
    FirebasesetFirebaseAppInstanceIdfirebaseAppInstanceId
    MixpanelsetMixpanelDistinctIDmixpanelDistinctId
    OneSignalsetOnesignalIDonesignalId
    AirshipsetAirshipChannelIDairshipChannelId
    CleverTapsetCleverTapIDcleverTapId
    IterablesetIterableUserIDiterableId
    TenjinsetTenjinAnalyticsInstallationIDtenjinId
    KochavasetKochavaDeviceIDkochavaId
    mParticlesetMparticleIDmparticleId
    Meta (Facebook)setFBAnonymousIDfbAnonymousId
    SegmentsetSegmentAnonymousIDsegmentId
    SingularsetSingularInstallIDsingularId
    MoEngagesetMoEngageAnonymousIDmoEngageAnonymousId
    AmplitudesetAmplitudeUserIDamplitudeUserId
    PostHogsetPosthogDistinctIDposthogDistinctId
    BrazesetBrazeIDbrazeId
    AirbridgesetAirbridgeDeviceIDairbridgeId

    All 20 providers are available on iOS, Android and React Native. Separately from these setters, Amplitude, Mixpanel, Segment and Braze can receive subscription events from BillDog’s servers, keyed on your app user ID. See Analytics & Attribution Pipeline. There is no Firebase forwarding yet.

    iOS example

    import BillDogFull
    import Adjust
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions ...) -> Bool {
        BillDog.shared.configure(config: .init(apiKey: "YOUR_API_KEY"))
    
        // Setters are async throws. They attach the ID to this install's
        // customer (the one configure() set up, or the one identify() names),
        // so they can run right after configure.
        Task {
            try? await BillDog.shared.setAppsflyerId(AppsFlyerLib.shared().getAppsFlyerUID())
            if let firebaseId = Analytics.appInstanceID() {
                try? await BillDog.shared.setFirebaseAppInstanceId(firebaseId)
            }
            try? await BillDog.shared.setMixpanelDistinctID(Mixpanel.mainInstance().distinctId)
    
            // Adjust resolves its ID asynchronously.
            Adjust.adid { adid in
                guard let adid else { return }
                Task { try? await BillDog.shared.setAdjustId(adid) }
            }
        }
        return true
    }

    Android example

    import io.billdog.core.BillDog
    import kotlinx.coroutines.CoroutineScope
    import kotlinx.coroutines.Dispatchers
    import kotlinx.coroutines.launch
    
    class MyApplication : Application() {
        private val scope = CoroutineScope(Dispatchers.IO)
    
        override fun onCreate() {
            super.onCreate()
            BillDog.configure(this, apiKey = "YOUR_API_KEY")
    
            // Setters are suspend functions returning Result<Unit>. They address the
            // SDK's current app user id, which configure establishes, so they can
            // run straight away.
            scope.launch {
                // AppsFlyer
                BillDog.getInstance().setAppsflyerId(
                    AppsFlyerLib.getInstance().getAppsFlyerUID(this@MyApplication)
                )
    
                // Adjust
                Adjust.getAdid { adid ->
                    scope.launch { BillDog.getInstance().setAdjustId(adid) }
                }
    
                // Firebase
                FirebaseAnalytics.getInstance(this@MyApplication).appInstanceId.addOnSuccessListener { id ->
                    scope.launch { BillDog.getInstance().setFirebaseAppInstanceId(id) }
                }
            }
        }
    }

    Device identifiers (IDFA / GAID)

    Device identifiers take two calls. collectDeviceIdentifiers() only reads them on the device and returns them; it sends nothing. setDeviceIdentifiers(_:) uploads them to the customer. Adjust forwarding uses them (alongside the Adjust ID), and AppsFlyer forwarding sends them when they are present.

    • iOS collects the IDFV, the ATT status and limit-ad-tracking flag, and the IDFA only when the user has authorised tracking. Call it after the ATT prompt.
    • Android collects the Google advertising ID (none when ad tracking is limited) and the limit-ad-tracking flag.
    // iOS
    import AppTrackingTransparency
    import BillDogFull
    
    ATTrackingManager.requestTrackingAuthorization { _ in
        Task {
            let identifiers = await BillDog.shared.collectDeviceIdentifiers()
            try? await BillDog.shared.setDeviceIdentifiers(identifiers)
        }
    }
    
    // Android: both are suspend functions; setDeviceIdentifiers returns Result<Unit>
    scope.launch {
        val identifiers = BillDog.getInstance().collectDeviceIdentifiers()
        BillDog.getInstance().setDeviceIdentifiers(identifiers)
    }

    Fixed on the server on 2026-10-17: the API used to reject setDeviceIdentifiers from the iOS and Android SDKs (1.1.1-beta.3 and earlier send a backend project reference where the endpoint wanted the project UUID, and iOS sends idfa: null without tracking permission). The endpoint now takes the project from your API key and accepts null for an identifier that isn’t available, so these SDK versions work without an update. Identifiers are stored from the next call; events sent before that were forwarded to Adjust without one.

    React Native exposes collectDeviceIdentifiers() but not setDeviceIdentifiers, so it can’t upload device identifiers. On Android, setDeviceIdentifiers is gated by the consent flag like the attribution setters. On iOS it isn’t, so check your own consent state before calling it.

    Ordering: the SDK needs a customer first

    Attribution setters name the customer by the SDK’s own identity. On iOS and Android the setter addresses the SDK’s current app user id, which configure always establishes, and the server creates the customer on the first write — so the setters work as soon as configure has run, with no customer loaded. React Native and Flutter call the same native setters. (SDK versions before this behaviour shipped required a loaded customer: on iOS the setter threw, on Android it returned a failed Result (“No customer loaded”), and on React Native the failure wasn’t reported — if you are on such a version, await getCustomerInfo() first.) Whichever customer the SDK acts for — the one it establishes on its own, the one you name with identify, or the one a BillDog Auth sign-in returns — is the one the identifier is stored on.

    In practice this is why attribution wiring belongs in a task that runs after customer info has loaded, not on the line immediately following configure. Third-party SDKs resolve their own IDs asynchronously anyway, so the natural pattern — set it when the vendor's callback fires — is also the correct one.

    The third route has a step you have to take yourself. A successful sign-in resolves the user’s customer and returns its id on the session as customerId, but it does not switch the SDK’s current customer. Until you call identify with that id, the setters keep attaching identifiers to whichever customer the SDK already had — they will not fail, they will simply credit the wrong one. See Sessions & Tokens for what the session carries.

    Merge semantics

    Values are merged field by field. Setting one provider's identifier never clears another's, and a null or missing value preserves whatever was already stored rather than wiping it. You can therefore call setters independently, in any order, as each vendor's SDK becomes ready.

    Consent gating

    The attribution setters are gated by the SDK’s consent flag (!consentRequired || consentGiven). If your app requires consent and it hasn’t been given, a setter fails: iOS throws, and Android returns a failed Result. Nothing is queued and nothing leaves the device. After you call setConsentGiven(true), call the setters again.

    Server-to-server forwarding

    Adjust

    In Dashboard → Integrations → Adjust (/dashboard/integrations), enter your App Token and S2S Security Token, and paste an Adjust event token for each BillDog event you want sent (subscription_created, subscription_cancelled, subscription_uncancelled, subscription_expired, purchase_completed, purchase_refunded). BillDog then posts each event to Adjust’s S2S event endpoint:

    • The event is attributed with every identifier BillDog has for the customer: the Adjust ID you store with setAdjustId (sent as adid) and the device identifiers (IDFA, IDFV, Google advertising ID) uploaded with setDeviceIdentifiers.
    • Events with no event token are skipped (no_event_token). Customers with neither an Adjust ID nor a stored device identifier are skipped (no_device_identifier). This usually means a customer who has only used web checkout, because both come from the iOS and Android SDKs.
    • Revenue is sent in USD (the converted amount), and only on a paid purchase or renewal (subscription_created, purchase_completed): never on a cancellation, an expiry, a refund or a failed payment. The environment is sandbox or production to match the purchase, and your app user ID and the event’s product fields go in the callback parameters.

    Device identifiers reach BillDog from the iOS and Android SDKs once the app calls setDeviceIdentifiers (see the note above: the server-side fix of 2026-10-17 covers SDK 1.1.1-beta.3 and earlier, with no app update).

    AppsFlyer

    In Dashboard → Integrations → AppsFlyer, enter your S2S key and your iOS and/or Android app ID. BillDog then posts each event to AppsFlyer’s S2S in-app event endpoint:

    • The event is attributed by the AppsFlyer ID you store with setAppsflyerId (or the one imported from RevenueCat or Adapty). Customers without one are skipped (no_appsflyer_id), so set it before the first purchase. Stored device identifiers are added when present.
    • Trial starts, subscription starts, renewals, purchases, refunds, cancellations, uncancellations and expirations are sent. Revenue is in USD: positive on a paid start, renewal or purchase, negative on a refund, absent otherwise.
    • AppsFlyer’s S2S API has no sandbox mode, so sandbox purchases are not sent. Web (Stripe) purchases are not sent either, because they are not app events.

    Coming soon

    Server-to-server forwarding to Branch and Firebase. Their IDs can already be stored with the setters above, but BillDog doesn’t send them anything yet.

    Related

    Was this page helpful?

    Or rate this page:

    We use cookies and process your data to provide our services. By continuing, you agree to our Terms and Privacy Policy.