skyanalytics 0.0.4
skyanalytics: ^0.0.4 copied to clipboard
SkyAnalytics Flutter is an adapter for [SkyAnalytics]. It provides a way to use SkyAnalytics in your Flutter application.
SkyAnalytics Flutter #
SkyAnalytics Flutter is an adapter for SkyAnalytics that allows you to track your website's traffic and user behavior.
Installation #
Add the following to your pubspec.yaml
file:
dependencies:
skyanalytics: ^0.1.0
Usage #
import 'package:skyanalytics/skyanalytics_flutter.dart';
const skyAnalytics = SkyAnalytics(
sourceKey: 'sourceKey',
host: 'https://example.com',
enabled: true, // default is true
showLogs: false, // default is false
);
skyAnalytics.event(name: 'create_element');
skyAnalytics.navigate(screenName: 'home');
skyAnalytics.metadata({
'key1': 'value1',
'key2': 'value2',
});
skyAnalytics.bugReport(
description: 'This is a bug report',
name: 'Carlos',
contact: 'email@gmail.com',
);
NavigatorObserver #
final navigatorObserver = SkyAnalyticsNavigatorObserver(skyAnalytics: skyAnalytics);
MaterialApp(
navigatorObservers: [navigatorObserver],
home: HomeScreen(),
);
Important: The SkyAnalyticsNavigatorObserver
needs the RouteSettings
to be set in order to track the screen name. If you are using the MaterialApp
widget, the RouteSettings
are automatically set. If you are using a custom Navigator
, you need to set the RouteSettings
manually.