Linklytics Flutter Plugin

A comprehensive Flutter plugin for integrating Linklytics analytics, deep linking, and community features into your application.

Features

  • 📊 Analytics: Track custom events, user interactions, and app performance.
  • 🔗 Deep Linking: Handle deferred deep links (attribution) and universal links.
  • 🛠 Dynamic Links: Generate short tracking links programmatically.
  • 💬 Community & Blog: Built-in UI for community forums and blogs (powered by Linklytics).

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  linklytics_flutter: ^1.1.8

Then run:

flutter pub get

Usage

1. Initialization

Initialize the SDK early in your app's lifecycle (e.g., in main.dart).

import 'package:linklytics_flutter/linklytics_flutter.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Create an instance
  final linklytics = LinklyticsFlutter();
  
  // Initialize with your API Key
  await linklytics.initialize(
    apiKey: 'YOUR_API_KEY',
    isDebug: true, // Enable logs for debugging
  );
  
  runApp(MyApp());
}

2. Tracking Events

Send custom events to track user actions.

final linklytics = LinklyticsFlutter();

await linklytics.sendEvent(
  'purchase_completed',
  {
    'item_id': 'sku_123',
    'value': 99.99,
    'currency': 'USD'
  }
);

Listen for deep links (including deferred links from installs).

// Check for links on app start or when resumed
final linklytics = LinklyticsFlutter();

await linklytics.getLink((DeepLinkRoute route) {
    print("Deep Link Received: ${route.route}");
    print("Parameters: ${route.parameters}");
    
    // Navigate based on route
    if (route.route.contains('/product')) {
        // navigatorKey.currentState?.pushNamed(...)
    }
});

Create short tracking links programmatically to share content.

final linklytics = LinklyticsFlutter();

String? shortUrl = await linklytics.generateLink(
  route: 'product/123',
  params: {
    'referrer': 'user_456',
    'source': 'share_button'
  },
  shortLink: true // Set to false for long URL
);

print("Share this link: $shortUrl");

5. Community & Blogs (UI)

Linklytics comes with pre-built Community and Blog pages.

Required Setup: Ensure GetX and Dio are initialized in your app.

void main() {
  Get.put(Dio()); // Required for network calls
  LinklyticsNavigator.initializeControllers(); // Initialize controllers
  runApp(MyApp());
}

Open Community:

ElevatedButton(
  onPressed: () {
    LinklyticsNavigator.openCommunities();
  },
  child: Text("Open Community"),
)

Open Blogs:

ElevatedButton(
  onPressed: () {
    LinklyticsNavigator.openBlogs();
  },
  child: Text("Read Blog"),
)

Platform Support

Platform Support Min Version
Android ✅ API 21+
iOS ✅ iOS 11.0+

License

This project is licensed under the MIT License - see the LICENSE file for details.

Libraries

blogs/blogs
blogs/controllers/blog_controller
blogs/data/models/blog_post
blogs/data/models/blog_response
blogs/data/services/blog_api_service
blogs/presentation/blog_detail_page
blogs/presentation/blogs_page
blogs/presentation/widgets/blog_card
client/api_service
community/constants/community_constants
community/controllers/comment_controller
community/controllers/community_controller
community/controllers/post_controller
community/data/response/comment
community/data/response/common
community/data/response/community
community/data/response/community_response
community/data/response/community_user
community/data/response/posts_response
community/presentation/comments_page
community/presentation/community_detail_page
community/presentation/community_page
community/presentation/create_post_page
community/presentation/widgets/comment_input_sheet
community/presentation/widgets/comment_widget
community/presentation/widgets/post_widget
l10n/app_localizations
l10n/app_localizations_ar
l10n/app_localizations_de
l10n/app_localizations_en
l10n/app_localizations_es
l10n/app_localizations_fr
l10n/app_localizations_it
l10n/app_localizations_ja
l10n/app_localizations_ko
l10n/app_localizations_nl
l10n/app_localizations_pt
l10n/app_localizations_ru
l10n/app_localizations_sv
l10n/app_localizations_th
l10n/app_localizations_vi
l10n/app_localizations_zh
linklytics_flutter
linklytics_flutter_method_channel
linklytics_flutter_platform_interface
navigation/linklytics_navigator