Developer

Analytics

This package agregate functionality for tracking events on multiple services by observer interface implementation.

Installation

dart pub add eit_analytics  --hosted-url=https://gitea.whitelabel.mobile.embedit.dev/api/packages/platform/pub/

!IMPORTANT You need access token for fetching from private pub repository. ELI add token automatically

Usage

You need initialize EitAnalytics during initialization of your Dependency Injection like Embedit Injection

 EitAnalytics.init(
      AnalyticsConfig(
        enabled: kDebugMode,
        services: {
          FirebaseAnalyticsService(
            analytics: FirebaseAnalytics.instance,
            callOptions: AnalyticsCallOptions(global: true),
          ),
          AppCenterAnalyticsService(),
          ....
        },
        onLogAction: (message, event) {
          logger.d(' $message, event: $event');
        },
      ), 
      onInitialized: (analytics) {
        analytics.setDefaultEventParameters({
        'app_version': '1.0.0',
        });
        analytics.setUserId('12345');
        analytics.setUserProperties({
        'insider': 'true',
        });
        analytics.setDeviceProperties({
        'device_property': 'value',
        });
        analytics.setSessionTimeoutDuration(const Duration(seconds: 3).inMilliseconds);

        analytics.openApp(OpenaAppEvent());
        analytics.logIn(LoginEvent(loginMethod: 'email'));
    },
);

Observer

final rootNavigationKey = GloabalKey();
GoRouter(
    navigationKey: rootNavigationKey,
    observers:[
        EitAnalyticsNavigationObserver(rootNavigationKey)
    ]
)

Track event

With this tool you can track events on pre-defined or custom events.

/// My custom project specific event
class MyCustomEvent extends AnalyticsEvent{
    ....
}
...
onTap:(){
    /// pre-defined events
    EitAnalitics.instance.purchase(PurchaseEven());

    /// typesafe custom event
    EitAnalitics.instance.log(MyCustomEvent());
}

Button extensions

we have ready to use button extensions with automatic tracking TrackElevatedButton TrackOutlinedButton

    TrackElevatedButton.child(
        event: MyCustomEvent(),
        onPressed: (){ 
            ...
        }
    );
    TrackElevatedButton.icon(
        event: MyCustomEvent(),
        label: '...',
        icon: Icon(...)
        onPressed: (){ 
            ...
        }
    );

Future plan

We are planing to create interface for trackable UI Components in our UI Kit for Flutter


Copyright © 2025. All rights reserved.