The App Attribution Guide
Chapter 12

Setting up an attribution SDK on Android

Most Android attribution problems are set in the first week of integration, long before the first campaign goes live.

In short: On first open, an Android attribution SDK reads the install's source signals, chiefly the Google Play Install Referrer, and sends them to the MMP. Set it up in seven steps, then prove it with a test install from a Play testing track, because a debug build installed through adb always looks organic.

What does an attribution SDK do on Android?

An Android attribution SDK is a library inside the app that, on first open, collects the install's source signals, such as the Play Install Referrer and the advertising ID, sends them to a mobile measurement partner (MMP) for matching, and then records in-app events and deep link opens against the attributed install.

The SDK gathers evidence; the MMP decides. It compares that evidence with the clicks and network claims it holds, applies the windows, and credits a campaign or marks the install organic, as set out in how an install gets attributed.

First open: The first launch after install, when the referrer should be read and the install registered. Anything that delays or skips it, such as a crash or a login wall, costs attribution.

The seven setup steps

Every MMP's Android guide differs in detail, but the shape is the same.

1. Add the SDK and the referrer library

Add the MMP's SDK as a Gradle dependency, along with Google's Install Referrer library if the SDK does not bundle it. Google's current library is com.android.installreferrer:installreferrer:2.2, and the API needs Play Store app version 8.3.73 or later on the device.

  • If skipped or outdated: the SDK cannot read the referrer, and Play installs from tracked clicks can show as organic.

2. Initialise early, on every launch

Initialise the SDK in the Application class's onCreate, or as early as the SDK's guide allows, with the project key or token the MMP gives you.

  • What it does: registers the first open before the user can leave or get stuck on a sign-in screen.
  • If done late: initialising after login is a common general practice failure. Users who leave before that point are never counted.

3. Read the Play Install Referrer once, on first run

Most SDKs handle this, but check. Google's guidance is that referrer details are available for 90 days and do not change unless the app is reinstalled, and that the API should be called only once, on the first run after install.

  • What it does: returns the referrer URL plus the referrer click and install begin timestamps, which the MMP uses to match the install to a click. The details are in Android attribution and the install referrer.
  • Handle failures: a SERVICE_UNAVAILABLE response or a dropped connection while the Play Store updates means the SDK must reconnect. FEATURE_NOT_SUPPORTED means the device's Play Store cannot serve the referrer.
Meta's referrer: If you run Meta ads on Android, the Meta Install Referrer adds view-through and multi-session installs from Facebook, Instagram and Audience Network. Both Meta mechanisms return encrypted data, so the decryption key from the Meta App Dashboard must be set up in your MMP.

4. Advertising ID and consent

The Google Advertising ID (GAID) is the resettable advertising identifier on Android devices with Google Play services, which attribution SDKs read, where available and permitted, to recognise the same device across ad networks and reinstalls.

  • What it does: helps the MMP match network data and spot reinstalls.
  • Consent first: where your app needs consent before sharing data, initialise or send only after consent is recorded. Google, for example, says consent status for EEA users must be captured before app conversions are sent to an App Attribution Partner.
  • Check the manifest: follow your SDK's guide for any permission it needs to read the ID. A missing or zeroed ID does not stop referrer matching, but it weakens reinstall detection and network matching.

5. Deep link handling

Attribution links usually double as deep links, so the app must open them correctly.

  • Add an intent filter with android:autoVerify="true", the VIEW action, the DEFAULT and BROWSABLE categories, and http and https data entries for each link host.
  • Publish assetlinks.json at https://<host>/.well-known/assetlinks.json on every host, with the SHA-256 fingerprint of the Play app signing key. Google notes that with Play App Signing, a fingerprint from your local keystore will usually not match the one on users' devices.
  • Pass incoming links to the SDK, and for deferred deep links, wait for the SDK's callback before routing the first screen.

The mechanics of links that survive install are in deep linking and deferred deep linking.

6. Events and revenue

Send the events your campaigns optimise for, such as sign-up and purchase, with amount and currency on revenue events. If some events also come from your server, share a de-duplication key so nothing is counted twice. In-app events, postbacks and ROAS covers event naming.

7. Network settings in the MMP

Connect each ad network in the MMP dashboard, set the click and view windows per network, and map events to the network's conversion names. Without this, the SDK can work perfectly and self-attributing networks still never claim an install.

How do you verify installs are attributed?

Install a build from a Google Play testing track through a tracked test link, open it once, and check that the MMP credits the install to that link, with referrer and click timestamps attached. A debug build installed through adb has no Play referrer, so it will always show as organic.

Run these tests before the first campaign:

  1. Organic test: install from the testing track without a link. Expect one organic install.
  2. Link test: uninstall, tap a tracked test link, install from Google Play and open. Expect the install under that link's campaign.
  3. Deep link test: with the app installed, run adb shell am start -W -a android.intent.action.VIEW -d "<link>" <package>, then check adb shell pm get-app-links <package> shows each host as verified.
  4. Deferred deep link test: uninstall, tap a link to a specific screen, install and open. The app should land on that screen, not the home screen.
  5. Event test: complete sign-up and a test purchase, then confirm both events, with currency, appear against the attributed install.
  6. Reinstall test: uninstall and reinstall. The referrer resets on reinstall, so check how your MMP's re-attribution setting treats it.

Reading a failed test

What you seeLikely cause
Every test install is organicDebug build via adb, or the referrer is read too late
Link test credits the wrong campaignLink parameters mapped wrongly, or an older test click still inside the window
Link opens the browserautoVerify missing, or assetlinks.json has the upload or debug key fingerprint
Deferred link lands on homeApp routes before the SDK's deep link callback returns
Events appear but no revenueAmount or currency code missing on the event

Where an MMP's own guide fits

Each MMP publishes its own Android steps, and the order above maps onto them. Linkrunner, for example, offers native Android, React Native, Flutter, Expo, Capacitor, Cordova and Unity SDKs, and its Android attribution SDK setup guide walks through the same init, referrer, consent and deep link steps for its own SDK. For the App Links side specifically, this Android App Links setup guide checks the intent filter and assetlinks.json line by line.

Questions on this chapter

How long does an Android attribution SDK take to set up?

The code is usually small: a dependency, an initialisation call and event calls. Most of the time goes into deep links, event naming, network settings and testing on real Play installs.

Why are my Android test installs showing as organic?

The most common reason is testing with a debug build installed through adb, which has no Play Install Referrer. Install from a Google Play testing track through a tracked link instead, and check that the SDK initialises on the first launch.

Do I need the advertising ID for Android attribution?

Not for referrer-based matching, which works from the click data Google Play passes back. The advertising ID helps with reinstall detection and matching against ad network data, so read it where it is available and the user's consent allows.

Where should the SDK be initialised?

As early as possible, normally in the `Application` class's `onCreate`, so the first open is recorded before any sign-in or onboarding screen. Delaying it until after login loses installs from people who leave before signing in.

How do I test deferred deep links on Android?

Uninstall the app, tap a link that points to a specific screen, install from Google Play and open the app. If it lands on the home screen, the app is probably routing before the SDK returns the deep link.

What is mobile app attribution?

Mobile app attribution is the process of crediting each app install and in-app event to the ad, link or channel that drove it. It tells you which campaigns bring users, so you can move budget to the ones that work.