Cliqit SDK for Flutter

A powerful Flutter plugin for deep linking, attribution, and event tracking, powered by the Cliqit Native SDKs.

Features

  • Deep Linking: Handle incoming links and deferred deep links seamlessly.
  • Event Tracking: Track custom user actions and events with metadata.
  • Unified API: Simple, consistent Dart API for both Android and iOS.
  • Attribution: Get detailed attribution data for your users.

Installation

Android

  1. Add JitPack: Since the Android SDK is hosted on JitPack, you must add it to your android/settings.gradle (or android/build.gradle for older projects):

    dependencyResolutionManagement {
        repositories {
            google()
            mavenCentral()
            maven { url 'https://jitpack.io' } // Add this line
        }
    }
    
  2. Permissions: Ensure your AndroidManifest.xml includes internet permissions:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    

iOS

The SDK requires a minimum iOS version of 16.0. Ensure your ios/Podfile reflects this:

platform :ios, '16.0'

Usage

1. Initialize the SDK

Initialize the SDK as early as possible in your app's lifecycle, typically in main():

import 'package:cliqit/cliqit.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  await CliqitSDK.init("YOUR_API_KEY");
  
  runApp(MyApp());
}

Listen to the onLinkReceived stream to handle incoming links:

CliqitSDK.onLinkReceived.listen((data) {
  if (data != null) {
    print("Link received: ${data.url}");
    print("Path: ${data.destinationPath}");
    print("Parameters: ${data.parameters}");
  }
});

3. Track Events

Track custom events with optional metadata and user identification:

await CliqitSDK.trackEvent(
  "purchase",
  data: {"item": "coffee", "price": 4.99},
  userId: "user_123"
);

4. Validate API (Android Specific)

Check if your API key and configuration are valid:

await CliqitSDK.validateApi();

Example App

Check out the example folder for a complete implementation demonstration.