Routix Flutter SDK πŸš€

Pub Version License: MIT Build Status

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, and sale events 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());
}

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'];
}

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


πŸ“„ License

This SDK is distributed under the MIT License. See LICENSE for more information.

Libraries

routix_flutter