appfiliate 1.0.0
appfiliate: ^1.0.0 copied to clipboard
Lightweight install attribution SDK for mobile app affiliate marketing. Track which links drive installs and revenue.
Appfiliate Flutter SDK #
Lightweight install attribution for mobile app affiliate marketing. Pure Dart — no native code required.
Installation #
Add to your pubspec.yaml:
dependencies:
appfiliate: ^1.0.0
Then run:
flutter pub get
Setup #
1. Configure the SDK #
Call configure() once on app startup, before any other Appfiliate calls.
import 'package:appfiliate/appfiliate.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
Appfiliate.configure(appId: 'YOUR_APP_ID', apiKey: 'YOUR_API_KEY');
runApp(MyApp());
}
Your appId and apiKey are available in your Appfiliate dashboard.
2. Track installs #
Call trackInstall() on every app launch. It only sends data once per install — subsequent calls return the cached result.
final result = await Appfiliate.trackInstall();
print('Attributed: ${result.matched}');
3. Track purchases (optional) #
After a successful in-app purchase, report it to Appfiliate:
await Appfiliate.trackPurchase(
productId: 'premium_monthly',
revenue: 9.99,
currency: 'USD',
transactionId: purchaseDetails.purchaseID,
);
4. Link a user ID (optional) #
If you use RevenueCat or another subscription platform, link the user ID so server-side webhooks can attribute purchases automatically:
await Appfiliate.setUserId(Purchases.appUserID);
API Reference #
| Method | Description |
|---|---|
Appfiliate.configure(appId:, apiKey:) |
Initialize the SDK with your credentials |
await Appfiliate.trackInstall() |
Send install attribution (runs once per install) |
await Appfiliate.trackPurchase(...) |
Report an in-app purchase |
await Appfiliate.setUserId(userId) |
Link an external user ID for webhook attribution |
Appfiliate.isAttributed |
bool — whether the install was attributed |
Appfiliate.attributionId |
String? — the cached attribution ID |
Notes #
- No IDFA or ATT prompt required
- Under 200KB with zero native dependencies
- Safe to call
trackInstall()on every launch - Call
trackPurchase()after every successful purchase
Links #
- Website: appfiliate.io
- Dashboard: app.appfiliate.io