activity_flow 0.0.7
activity_flow: ^0.0.7 copied to clipboard
VTEX Activity Flow Flutter SDK
VTEX Activity Flow Mobile RUM for Flutter apps focused in Android and iOS.
Features #
This plugin coupled to an app, aims to:
- Track user navigation between app pages and send events.
Usage #
Import the package inside the main.dart file:
import 'package:activity_flow/activity_flow.dart';
Screen view event #
Create an instance of the Screen View observer class, by setting the account name:
void main() {
runApp(
...
final afObserver = PageViewObserver(accountName: 'Account 1');
...
)
}
Automatically tracks your route navigation using the previous AF observer instance created:
MaterialApp(
// Add the routeObserver to the navigatorObservers list.
navigatorObservers: [ afObserver ],
routes: {
... //define your named routes
},
);
Touch event #
Automatically tracks touch gesture using the detector as a Provider in your app, together with the page view observer to get routes names too.
return TouchDetector( //AF config
accountName: {accountName},
child: MaterialApp(
...
navigatorObservers: [afObserver], //AF config
),
);
Ad Events #
To start collecting ad events (impression, view, and click), use the extension addAdsListener at the end of any widget that is considered an ad widget. This extension receives a map of data params related to the ad. The adId and accountName params are mandatory.
return AnyAdWidget(
// Widget code ...
).addAdsListener({
"accountName": "example-store",
"adId": "ad-123",
"foo": "bar",
"abc": "xyz",
});