MatomoTracker class

Implementation of the Matomo Tracking HTTP API.

If this documentation refers to a correspondence with a parameter, check out the Tracking HTTP API documentation for more information on that parameter.

Constructors

MatomoTracker()
This is only used for testing purpose, because testing singleton is hard.

Properties

attachLastScreenInfo bool
Whether to attach pvId and path to track... calls automatically.
latefinal
authToken String?
no setter
contentBase String
URL for the current action.
latefinal
cookieless bool
no setter
customHeaders Map<String, String>
Custom http headers to add to each request.
latefinal
dequeueTimer Timer
getter/setter pair
dispatcher → MatomoDispatcher
no setter
hashCode int
The hash code for this object.
no setterinherited
initialized bool
no setter
log → Logger
final
optOut bool
no setter
pingTimer Timer?
getter/setter pair
queue Queue<Map<String, String>>
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
screenResolution Size
The resolution of the device the visitor is using, eg 1280x1024.
latefinal
session ↔ Session
latefinal
siteId int
The ID of the website we're tracking a visit/action for.
latefinal
url String
The url of the Matomo endpoint.
no setter
userAgent String?
The user agent is used to detect the operating system and browser used.
latefinal
visitor Visitor
no setter

Methods

clear() → void
Clear the following data from the local storage:
dispatchActions() Future<void>
Iterate on the actions in the queue and send them to Matomo.
dispose() → void
Cancel the timer which checks the queued actions to send
dropActions() → void
Drops all actions queued for dispatching.
getUserAgent({DeviceInfoPlugin? deviceInfoPlugin}) Future<String?>
initialize({required int siteId, required String url, bool newVisit = true, String? visitorId, String? uid, String? contentBaseUrl, DispatchSettings dispatchSettings = const DispatchSettings.nonPersistent(), Duration? pingInterval = const Duration(seconds: 30), String? tokenAuth, LocalStorage? localStorage, PackageInfo? packageInfo, PlatformInfo? platformInfo, bool cookieless = false, Level verbosityLevel = Level.off, Map<String, String> customHeaders = const {}, String? userAgent, bool attachLastScreenInfo = true}) Future<void>
Initialize the tracker.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void
resume() → void
setOptOut({required bool optOut}) Future<void>
setUrl(String newUrl) → void
Sets the url of the Matomo endpoint and updates the dispatcher.
setVisitorUserId(String? uid) → void
Sets the User ID.
toString() String
A string representation of this object.
inherited
trackCartUpdate({List<TrackingOrderItem>? trackingOrderItems, num? subTotal, num? taxAmount, num? shippingCost, num? discountAmount, String? pvId, String? path, Campaign? campaign, Map<String, String>? dimensions, bool? newVisit}) → void
Tracks a cart update.
trackContentImpression({required Content content, String? pvId, String? path, Campaign? campaign, Map<String, String>? dimensions, bool? newVisit}) → void
Tracks a content impression.
trackContentInteraction({required Content content, required String interaction, String? pvId, String? path, Campaign? campaign, Map<String, String>? dimensions}) → void
Tracks a content interaction.
trackDimensions({required Map<String, String> dimensions, String? pvId, String? path, Campaign? campaign, bool? newVisit}) → void
Tracks custom dimensions.
trackEvent({required EventInfo eventInfo, String? pvId, String? path, Campaign? campaign, Map<String, String>? dimensions, bool? newVisit}) → void
Tracks an event.
trackGoal({required int id, double? revenue, String? pvId, String? path, Campaign? campaign, Map<String, String>? dimensions, bool? newVisit}) → void
Tracks a conversion for a goal.
trackOrder({required String id, required double revenue, List<TrackingOrderItem>? trackingOrderItems, num? subTotal, num? taxAmount, num? shippingCost, num? discountAmount, String? pvId, String? path, Campaign? campaign, Map<String, String>? dimensions, bool? newVisit}) → void
Tracks an ecommerce order.
Tracks the click on an outgoing link.
trackPageView({required BuildContext context, String? pvId, String? path, Campaign? campaign, Map<String, String>? dimensions, PerformanceInfo? performanceInfo, bool? newVisit}) → void
This will register a page view with trackPageViewWithName by using the context.widget.toStringShort() as actionName value.
trackPageViewWithName({required String actionName, String? pvId, String? path, Campaign? campaign, Map<String, String>? dimensions, PerformanceInfo? performanceInfo, bool? newVisit}) → void
Registers a page view.
trackSearch({required String searchKeyword, String? searchCategory, int? searchCount, String? pvId, String? path, Campaign? campaign, Map<String, String>? dimensions, bool? newVisit}) → void
Tracks a search.
validateDimension(Map<String, String>? dimensions) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance MatomoTracker
final