m8ty_client_tracking
Tracking client to manage messages exchanges with the end user.
Before you start
Check the documentation of the m8ty_client_tracking library to get an idea about the available models and their properties.
import all needed libraries
import 'package:dio/dio.dart';
import 'package:m8ty_client_tracking/m8ty_client_tracking.dart';
import 'package:m8ty_client_common/m8ty_client_common.dart';
import 'package:built_collection/built_collection.dart';
How to perform different tasks
Here some examples how the dart client can be used
Create a tracking event
final trackingClient = M8tyClientTracking();
trackingClient.setApiKey(m8tyApiKeyAuth, "myApiKey");
final DefaultApi trackingApi = trackingClient.getDefaultApi();
final EventModel eventModel = EventModel((b) => b
..deviceId = "mydeviceid"
..eventName = "button_clicked"
..metadata = MapBuilder({"device_name": "apple phone"})
..timestamp = DateTime.now());
final trackEventsRequestModel = TrackEventsRequestModel(
(final b) => b.events = ListBuilder([eventModel]),
);
trackingApi.trackingEventsPost(trackEventsRequestModel: trackEventsRequestModel);
Last modified: 06 January 2025