SDK
Flutter SDK
Dart package for creator install attribution and promo-code offers. Configure once in main() before runApp.
Prerequisites
1. Add the dependency
dependencies:
tapapplink: ^0.3.3Then flutter pub get.
2. Configure, track, identify
import 'package:tapapplink/tapapplink.dart';
TapAppLink.configure(TapAppLinkConfig(
publicKey: 'YOUR_TAPAPPLINK_KEY',
environment: kDebugMode
? TapAppLinkEnvironment.sandbox
: TapAppLinkEnvironment.production,
));
await TapAppLink.trackInstall();
await TapAppLink.setAppUserId(await Purchases.appUserID);
final offer = TapAppLink.getOffer();3. Discount codes
TapAppLink.getOffer() after a match. await TapAppLink.applyCode('SARAH10') when the user types a code. Discount codes.
SDK reference
| Method | Purpose |
|---|---|
configure | Set public key, environment, optional ingest URL. |
trackInstall() | First open. Matches a recent click in this environment. |
setAppUserId(id) | Bridge the billing customer id for webhooks. |
getOffer() | Creator discount after a match or redeem. |
applyCode(code) | Attribute from a promo code typed at checkout. |
resetForTesting() | Clear cached install state in debug builds. |
Important notes
- trackInstall() is safe to call on every launch from SDK 0.3.0 or later (React Native also needs @react-native-async-storage/async-storage installed).
- Call resetForTesting() in debug builds before repeating a match test on the same install.
- Purchases are attributed through billing webhooks. Do not add a client trackPurchase() call.
- After a match or applyCode(), present getOffer() on the paywall.