opus_tracking 0.0.8
opus_tracking: ^0.0.8 copied to clipboard
@opus/tracking
opus_tracking #
OPUS Tracking package
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
opus_tracking: ^0.0.8
Usage #
Setup #
Please following detail usage in example.
Import the package wherever you need it.
import 'package:opus_tracking/shelf.dart';
Add the root component, create a global EventClient
EventClient eventClient = EventTrackingFactory.create(
tenantId: 'your-tenant-id', apiKey: 'your-api-key');
eventClient.setSource('your-source');
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);
// default is Env.dev
eventClient.setEnv(Env.qa);
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);