Skip to content

feat(attribution): send the Google Play install referrer with the install - #19

Merged
onamfc merged 3 commits into
mainfrom
feat/play-install-referrer
Oct 22, 2026
Merged

onamfc merged 3 commits into
mainfrom
feat/play-install-referrer

Conversation

@onamfc

@onamfc onamfc commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

On the launch that reports the install, the SDK reads the Google Play install referrer and sends it as installReferrer on POST /api/sdk/v1/install. The redirect puts the link's click id in the referrer of every Play listing it sends an Android visitor to (LinkForty/core#84), so the server matches the install to that exact click (attributionMethod: "install_referrer", confidenceScore 100, competingLinks 0) instead of by fingerprint.

  • PlayInstallReferrerSource (new): InstallReferrerClient behind a 2-second timeout. If Play's service is briefly unavailable or drops the connection, it asks once more within the same 2 seconds. It returns null without Play (another store, a sideload, an emulator without Play services), on any response code other than OK, and on any error. It always ends the connection.
  • AttributionManager reads it only when the install is being reported. A later launch, which returns the stored attribution, makes no Play call.
  • DeviceFingerprint.installReferrer: Moshi leaves a null out, so the request is byte-for-byte unchanged without a referrer. A server without this field drops the key and matches by fingerprint.
  • Dependency: com.android.installreferrer:installreferrer:2.2. Its manifest adds com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE, a normal permission that is granted without a prompt.

Tests: 4 unit tests (referrer sent, left out when Play has none, not read once the install is reported, JSON shape), for 205 in total. One instrumented test checks that the real reader finishes within its timeout and doesn't throw on the CI emulators.

No version bump: the release PR takes it. The changelog names @linkforty/core 1.41.1, the first release on npm with core#84.

…tall

On the launch that reports the install, the SDK reads the Play install referrer (Play Install Referrer API, at most 2 seconds) and sends it as installReferrer. A LinkForty link puts its click id in the referrer of the Play listing it sends a visitor to, so the server matches the install to that exact click. Without a referrer (another store, a sideload, no answer from Play, any error) the request is unchanged and the install is matched by fingerprint.

Adds com.android.installreferrer:installreferrer 2.2, which brings its normal-level BIND_GET_INSTALL_REFERRER_SERVICE permission.
…efly unavailable

SERVICE_UNAVAILABLE, SERVICE_DISCONNECTED or a dropped connection gets one more attempt after 250 ms, inside the same 2-second limit. Any other answer is final.
@onamfc
onamfc merged commit c8134f9 into main Oct 22, 2026
7 checks passed
@onamfc onamfc mentioned this pull request Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants