trackDimensions method
Tracks custom dimensions.
It is recommended to set the dimensions
parameter in one of the other
track calls instead of using this method (since it will log an additional
page view).
The keys of the dimensions
map correspond with the dimension[1-999]
parameters. This means that the keys MUST be named dimension1
,
dimension2
, ...
.
The keys of the dimensions
map will be validated if they follow these
rules, and if not, a ArgumentError will be thrown.
To see the dimensions in the Matomo dashboard, make sure to add them in the dashboard first.
To associate this action with a page view, enable attachLastScreenInfo and
leave pvId
to null
here or set pvId
to the pvId
of that page view
manually, e.g. TraceableClientMixin.pvId. Setting pvId
manually will
take precedance over attachLastScreenInfo.
path
is a string that identifies the path of the screen where this action
happend. If not null
, it will be appended to contentBase to create a
URL. This combination corresponds with url
. Also see attachLastScreenInfo.
Setting path
manually will take precedance over attachLastScreenInfo.
campaign
can be a campaign that lead to this action. Setting this multiple
times during an apps lifetime can have some side effects, see the Campaign
class for more information.
The newVisit
parameter can be used to make this action the begin
of a new visit. If it's left to null
and this is the first track...
call after MatomoTracker.initialize, the newVisit
from there will
be used.
Implementation
void trackDimensions({
required Map<String, String> dimensions,
String? pvId,
String? path,
Campaign? campaign,
bool? newVisit,
}) {
validateDimension(dimensions);
return _track(
MatomoAction(
pvId: _inferPvId(pvId),
path: _inferPath(path),
campaign: campaign,
dimensions: dimensions,
newVisit: _inferNewVisit(newVisit),
),
);
}