Getting started
Designing how and what to track in your app is an important decision. Check out our docs about tracking design here.
The following steps will guide you through setting up the Flutter tracker in your project and tracking a simple event.
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 to your pubspec.yaml:
dependencies:
snowplow_tracker: ^0.8.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 here. 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.5 or newer. You may also refer to the example project