Flutter Analytics for Conviva
tracker-classificiation
[![Build Status]gh-actions-image
]gh-actions
[![Release]release-image
]releases
[![License]license-image
]license
Conviva Flutter Tracker Overview
The Conviva Flutter Tracker allows you to add analytics to your Flutter apps when using a Conviva pipeline.
With this tracker you can collect granular event-level data as your users interact with your Flutter applications. It is build on top of Conviva's native iOS and Android and web trackers, in order to support the full range of out-of-the-box Conviva events and tracking capabilities.
Features
Feature | Android | iOS | Web |
---|---|---|---|
Manual tracking of events: screen views, button clicks, self-describing, structured, timing, consent granted and withdrawal | ✔ | ✔ | ✔ |
Automatic tracking of views events from Navigator API | ✔ | ✔ | ✔ |
Adding custom context entities to events | ✔ | ✔ | ✔ |
Support for multiple trackers | ✔ | ✔ | ✔ |
Configurable subject properties | ✔ | ✔ | partly |
Session context entity added to events | ✔ | ✔ | ✔ |
Geo-location context entity | ✔ | ✔ | ✔ |
Mobile platform context entity | ✔ | ✔ | |
Web page context entity | ✔ | ||
Configurable GDPR context entity | ✔ | ✔ | ✔ |
Quick Start
Installation
Add the Conviva tracker as a dependency to your Flutter application:
flutter pub add conviva_tracker
This will add a line with the dependency like this to your pubspec.yaml
:
dependencies:
conviva_tracker: ^0.3.10
Import the package into your Dart code:
import 'package:conviva_tracker/conviva_tracker.dart'
Installation on Web
If using the tracker within a Flutter app for Web, you will also need to import the Conviva JavaScript Tracker in your index.html
file. Please load the JS tracker with the Conviva tag as Do not change the global function name conviva
that is used to access the tracker – the Flutter APIs assume that it remains the default as shown in documentation.
Make sure to use JavaScript tracker version 0.3.14
or newer. You may also refer to the example project in the Flutter tracker repository to see this in action.
Using the Tracker
Instantiate a tracker using the Conviva.createConvivaTracker
function.
You may create the tracker in the initState()
of your main widget.
The function takes two required arguments: appName
and customerKey
that are required and provided to you by Conviva
ConvivaTracker tracker = await Conviva.createConvivaTracker(
appName: '{{YOUR_APP_NAME_ADVISED_BY_Conviva}}',
customerKey: '{{YOUR_CUSTOMER_KEY_ADVISED_BY_Conviva}}'
);
To track custom events, simply instantiate tracker as shown above and call tracker.trackCustomEvent
method as shown below.
Please refer to the documentation for specification of event properties.
// Tracking a custom event
final String name = "CustomEventName";
final String data = "{\"key\": \"value\"}"; // Stringified JSON with key value pairs
tracker.trackCustomEvent(name,data);
To report Page View events (in case of Web only), simply instantiate tracker as shown above and call tracker.trackPageView
method as shown below.
// Tracking a page view event – only supported on the Web
tracker.track(PageView(title: 'Page Title'));
To report Button Click event, simply instantiate tracker as shown above and call tracker.track
method as shown below.
Please refer to the documentation for specification of event properties.
// Tracking a button click event
const event = ButtonClick(elementType: 'Element Type', elementId: 'Element Id', elementName: 'Element Name', elementClasses: 'Element Class', elementText: 'Element Text', elementValue: 'Element Value');
tracker.track(event);
To report Screen View event, simply instantiate tracker as shown above and call tracker.track
method as shown below.
Please refer to the documentation for specification of event properties.
// Tracking a screen view event
const event = ScreenView(id: 'Screen Id', name: 'Screen Name', type: 'Screen Type', transitionType: 'Transition Type');
tracker.track(event);
Find Out More
Technical Docs | Setup Guide |
---|---|
[![i1]techdocs-image ]techdocs |
[![i2]setup-image ]setup |
techdocs |
setup |
Maintainers
Contributing |
---|
[![i4]contributing-image ](CONTRIBUTING.md) |
Contributing |
Maintainer Quick Start
Assuming Flutter SDK is set up
Clone Repository
Copyright and License
The Conviva Flutter Tracker is copyright 2022 Conviva
Licensed under the license
(the "License");
you may not use this software except in compliance with the License.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Libraries
- configurations/configuration
- configurations/emitter_configuration
- configurations/gdpr_configuration
- configurations/network_configuration
- configurations/subject_configuration
- configurations/tracker_configuration
- configurations/web_activity_tracking
- conviva
- conviva_observer
- conviva_tracker
- conviva_tracker_plugin_web
- events/consent_granted
- events/consent_withdrawn
- events/event
- events/page_view_event
- events/screen_view
- events/self_describing
- events/structured
- events/timing
- tracker