
matomo_tracker
Forked from the package matomo by poitch.
A fully cross-platform wrap of the Matomo tracking client for Flutter, using the Matomo Tracking API.
Getting Started
As early as possible in your application, you need to configure the Matomo Tracker to pass the URL endpoint of your instance and your Site ID.
await MatomoTracker.instance.initialize(
siteId: siteId,
url: 'https://example.com/matomo.php',
);
If you need to use your own Visitor ID, you can pass it at the initialization of MatomoTracker as is:
await MatomoTracker.instance.initialize(
siteId: siteId,
url: 'https://example.com/matomo.php',
visitorId: 'customer_1',
);
To track views simply add TraceableClientMixin
on your State
:
You can also optionally call directly trackScreen
or trackScreenWithName
to track a view.
For tracking goals and, events call trackGoal
and trackEvent
respectively.
A value can be passed for events:
MatomoTracker.instance.trackEvent(
name: 'eventName',
action: 'eventAction',
eventValue: 'eventValue',
);
Opting Out
If you want to offer a way for the user to opt out of analytics, you can use the setOptOut()
call.
MatomoTracker.instance.setOptOut(optout: true);