Skip to content

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

Merged
onamfc merged 1 commit into
mainfrom
feat/play-install-referrer
Oct 22, 2026
Merged

onamfc merged 1 commit into
mainfrom
feat/play-install-referrer

Conversation

@onamfc

@onamfc onamfc commented Oct 22, 2026

Copy link
Copy Markdown
Member

On Android, the launch that reports the install 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.

  • PlayInstallReferrer.read() (new, lib/attribution/install_referrer.dart) uses the android_play_install_referrer plugin (Android only; com.android.installreferrer 2.2).
    • It has a 2-second limit and asks once more after a failed read, within that limit.
    • It returns null off Android, for an empty referrer, on timeout, without the plugin, and on any error. It never throws.
  • AttributionManager takes an optional readInstallReferrer. It starts the read alongside the fingerprint, only on the launch that reports the install, and adds installReferrer to the body only when there is one.
  • LinkForty.initialize takes a @visibleForTesting installReferrerReader.
  • 0.6.0: pubspec, SdkInfo.version, CHANGELOG, README pin, example lockfile.

Checked: flutter test (174 pass, 10 of them new: 7 for the reader, 3 for the manager), flutter analyze, dart format, and flutter build apk --debug of the example app with the plugin. CI doesn't build an Android app.

Plugin choice: the most used Play referrer plugin on pub.dev, about 128k downloads in the last 30 days. Its last release was 04-06-2024. It applies the Kotlin Gradle Plugin, as device_info_plus, package_info_plus and shared_preferences_android here do too. Flutter warns that a future version will require those plugins to migrate.

…tall

On Android, the launch that reports the install reads the Play install referrer (android_play_install_referrer, at most 2 seconds, one retry after a failed read) and sends it as installReferrer, so the server matches the install to the click the LinkForty link put there. On iOS, and without a referrer, the request is unchanged and the install is matched by fingerprint.

Bumps to 0.6.0.
@onamfc
onamfc merged commit 3051e5b into main Oct 22, 2026
4 checks passed
@onamfc
onamfc deleted the feat/play-install-referrer branch October 22, 2026 03:31
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