opus_tracking
Opus Tracking is a Flutter package that provides utilities for integrating tracking and analytics features into your Flutter applications. With Opus Tracking, you can easily track user interactions, events, and behaviors within your app to gain insights and improve user experience.
Installation
Add this to your package's pubspec.yaml
file:
dependencies:
opus_tracking: ^0.1.5
Usage
Setup
Please following detail usage in example
.
Import the package wherever you need it.
import 'package:opus_tracking/opus_tracking.dart';
Add the root component, create a global EventClient
EventClient eventClient = EventTrackingFactory.create(
tenantId: 'your-tenant-id',
apiKey: 'your-api-key',
source: 'your-application-source',
apiDomain: 'your-api-domain'
);
With setSource
function please provide your name of source (ex: mobile, web, ...).
In your navigate function, if you enter the other screen, please call:
eventClient.addScreenName(
IScreen(
uiKey: generateRandomString(10),
name: 'your-screen-name'
)
);
and if you go back, please call:
eventClient.removeScreenName();
Additional functions
If you want to use a custom config, please pass it as a 'config' param:
EventClient eventClient = EventTrackingFactory.create(
tenantId: 'your-tenant-id',
apiKey: 'your-api-key',
config: {
'common_properties': {
'user_id': 'user_id',
},
'source': 'source',
}
);
Also, you can use some function that can be custom you tracking event:
eventClient.setApiDomain('your-api-domain');
eventClient.setApiKey('your-api-key');
eventClient.setBasicInfo({
'domain': 'your-domain'
});
eventClient.setIsAuthenticated(true);
Tracking event
Click tracking
IClickParams params = IClickParams(additionalData: {});
eventClient.logClickEvent('your-button-ui-key', params: params);
Screen tracking
IScreenParams params = IScreenParams(additionalData: {});
eventClient.logScreenEvent('screen-name', params: params);
Behavior tracking
dynamic params = {};
eventClient.logBehaviourEvent('behavior-name', params: params);
Handling Exceptions
tenantId must not be empty
tenantId must not be ""
apiKey must not be empty
apiKey must not be ""
apiDomain must not be empty
apiDomain must not be ""
source must not be empty
source must not be ""