clippr 0.0.4
clippr: ^0.0.4 copied to clipboard
Deep linking and mobile attribution SDK for Flutter. Seamless replacement for Firebase Dynamic Links.
Clippr Flutter SDK #
Deep linking and mobile attribution SDK for Flutter. A seamless replacement for Firebase Dynamic Links.
Installation #
Add to your pubspec.yaml:
dependencies:
clippr: ^0.0.4
Quick Start #
1. Initialize the SDK #
import 'package:clippr/clippr.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Clippr.initialize(apiKey: 'your_api_key_here');
runApp(MyApp());
}
2. Handle Deep Links #
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
_initDeepLinks();
}
Future<void> _initDeepLinks() async {
// Get the link that opened the app (direct or deferred)
final link = await Clippr.getInitialLink();
if (link != null) {
_handleDeepLink(link);
}
// Listen for links while app is running
Clippr.onLink = (link) {
_handleDeepLink(link);
};
}
void _handleDeepLink(ClipprLink link) {
print('Path: ${link.path}');
print('Campaign: ${link.attribution?.campaign}');
// Navigate based on path
if (link.path.startsWith('/product/')) {
final productId = link.path.split('/').last;
Navigator.pushNamed(context, '/product', arguments: productId);
}
}
}
3. Track Events (Optional) #
// Track a simple event
await Clippr.track('signup_completed');
// Track with parameters
await Clippr.track('add_to_cart', params: {
'product_id': '12345',
'price': 29.99,
});
// Track revenue
await Clippr.trackRevenue(
'purchase',
revenue: 99.99,
currency: 'USD',
params: {'product_id': '12345'},
);
Platform Setup #
iOS #
Add Associated Domains capability in Xcode:
- Open your iOS project in Xcode
- Select your target → Signing & Capabilities
- Click "+ Capability" and add "Associated Domains"
- Add:
applinks:yourapp.clppr.xyz
Android #
Add intent filter to your AndroidManifest.xml:
<activity android:name=".MainActivity">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="yourapp.clppr.xyz" />
</intent-filter>
</activity>
API Reference #
Clippr #
| Method | Description |
|---|---|
initialize(apiKey:, debug:) |
Initialize the SDK |
getInitialLink() |
Get the link that opened the app |
onLink |
Callback for links received while app is running |
track(eventName, params:) |
Track a custom event |
trackRevenue(eventName, revenue:, currency:, params:) |
Track a revenue event |
ClipprLink #
| Property | Type | Description |
|---|---|---|
path |
String |
The deep link path (e.g., "/product/123") |
metadata |
Map<String, dynamic>? |
Custom metadata attached to the link |
attribution |
Attribution? |
Campaign attribution data |
matchType |
MatchType |
How the link was matched |
confidence |
double? |
Match confidence (0.0 - 1.0) |
MatchType #
| Value | Description |
|---|---|
direct |
User clicked link with app installed |
deterministic |
Matched via Install Referrer (Android, 100% accurate) |
probabilistic |
Matched via device fingerprinting |
none |
No match found |
Migration from Firebase Dynamic Links #
| Firebase Dynamic Links | Clippr |
|---|---|
FirebaseDynamicLinks.instance.getInitialLink() |
Clippr.getInitialLink() |
FirebaseDynamicLinks.instance.onLink |
Clippr.onLink |
The API is intentionally similar for easy migration.
Requirements #
- Flutter 3.10+
- iOS 13.0+
- Android API 21+
License #
MIT License. See LICENSE for details.