routix_flutter 1.0.6
routix_flutter: ^1.0.6 copied to clipboard
Official Routix SDK for Flutter. Track app installs, attribute deep links, and measure conversion events with ease.
Routix Flutter SDK π #
The official Routix SDK for Flutter. Empower your mobile application with industry-leading attribution, deep linking, and conversion measurement.
π Table of Contents #
π Features #
- π― Precision Attribution: Automatically resolve deep links using Android Install Referrer and iOS Fingerprinting.
- π Conversion Tracking: Measure
install,lead, andsaleevents with high-fidelity metadata. - β‘ Lightweight & Fast: Minimal footprint with zero external dependencies beyond standard networking and device info.
- π‘οΈ Privacy Focused: Designed to respect user privacy while maintaining attribution accuracy.
π¦ Installation #
Add routix_flutter to your pubspec.yaml:
dependencies:
routix_flutter: ^1.0.5
Android Setup #
To support Install Referrer attribution, ensure you have the following in your android/app/build.gradle:
dependencies {
implementation 'com.android.installreferrer:installreferrer:2.2'
}
iOS Setup #
No extra configuration is required for basic attribution. For enhanced accuracy using the clipboard fallback, ensure your Info.plist includes the necessary descriptions if your app accesses the clipboard for other purposes.
π οΈ Usage #
1. Initialize the SDK #
Initialize Routix in your main() function or as early as possible.
import 'package:routix_flutter/routix_flutter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Routix.initialize(
apiKey: 'your_workspace_api_key'
);
runApp(MyApp());
}
2. Resolve Deep Links (Deferred) #
The resolve() method checks if the user arrived via a Routix link (e.g. from the App Store). It is idempotentβit handles the "first-open" logic automatically.
// enableClipboard: true significantly improves iOS accuracy
final match = await Routix.resolve(enableClipboard: true);
if (match != null && match.success) {
print('Attributed to: ${match.shortCode}');
// Access custom metadata set in the Routix dashboard
final promo = match.metadata?['promo_code'];
}
3. Handle Deep Links (Direct) #
Parses a direct deep link URL when the app is already installed. This is handled locally without hitting the network.
// Use a deep linking plugin like 'uni_links' to capture the incoming URL
String? initialLink = await getInitialLink();
if (initialLink != null) {
final match = Routix.handleDeepLink(initialLink);
if (match?.success == true) {
print('Opened via: ${match?.shortCode}');
}
}
4. Track Events #
Tie conversion events directly to a campaign short code for ROI analysis.
await Routix.trackSale(
'SUMMER_24',
amount: 49.99,
currency: 'USD',
metadata: {'product_id': 'premium_pkg'}
);
5. Track Custom Events #
Track workspace-level actions like signups or tutorial completions independent of any link.
await Routix.trackCustomEvent('user_signup', metadata: {'method': 'google'});
π€ Support #
- Documentation: routix.link/docs
- Issues: Report bugs via the GitHub Issue Tracker
π License #
This SDK is distributed under the MIT License. See LICENSE for more information.