Flutter Tracker 0.1.0 released

We are very excited to announce the first release of our tracker for Flutter apps. The package is published on pub.dev as snowplow_tracker.

Key features

The tracker is built as a wrapper around our mature trackers for iOS, Android, and the Web (all in version 3). This provides it a solid and well-tested foundation with a range of features.

It brings the following functionality:

  • Manual tracking of events: screen views, page views (on Web), self-describing, structured, timing, consent granted and withdrawal
  • Automatic tracking of view events (page or screen view) from Flutter Navigator API
  • Web activity tracking using page view and page ping events
  • Mobile session context entity added to events (even on Web)
  • Adding custom context entities to events
  • Support for multiple trackers
  • Configurable subject properties
  • Geo-location context entity
  • Mobile platform context entity (iOS, Android only)
  • Web page context entity (Web only)
  • Configurable GDPR context entity

Quickstart

Installation

Add the Snowplow tracker as a dependency to your Flutter application:

flutter pub add snowplow_tracker

This will add a line with the dependency like this to your pubspec.yaml:

dependencies:
    snowplow_tracker: ^0.1.0

Import the package into your Dart code:

import 'package:snowplow_tracker/snowplow_tracker.dart'

Installation on Web

If using the tracker within a Flutter app for Web, you will also need to import the Snowplow JavaScript Tracker in your index.html file. Please load the JS tracker with the Snowplow tag as described in the official documentation. Do not change the global function name snowplow 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 3.2 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 Snowplow.createTracker function:

SnowplowTracker tracker = await Snowplow.createTracker(
    namespace: 'ns1',
    endpoint: 'http://...'
);

To track events, simply instantiate their respective types (e.g., ScreenView, SelfDescribing, Structured) and pass them to the tracker.track or Snowplow.track methods.
Please refer to the documentation for specification of event properties.

// Tracking a screen view event
tracker.track(ScreenView(
    id: '2c295365-eae9-4243-a3ee-5c4b7baccc8f',
    name: 'home',
    type: 'full',
    transitionType: 'none'));

Check out the Snowplow Docs section for more information about setting up and using the tracker.

Feedback and contributing

We are very keen to hear your feedback to shape the future releases of this tracker! Please feel free to open discourse topics with ideas, and add issues and bug reports to the repo.

We also welcome contributions and PRs. If in doubt, open an issue or a discourse post to ask about your contribution - important contributions - especially bugfixes - will be prioritised.

4 Likes