trackContentInteraction method

void trackContentInteraction({
  1. required Content content,
  2. required String interaction,
  3. String? pvId,
  4. String? path,
  5. Campaign? campaign,
  6. Map<String, String>? dimensions,
})

Tracks a content interaction.

Use trackContentImpression instead if the content was shown to the user, but he did not interact with it.

The interaction corresponds with c_i and should describe the type of interaction, e.g. tap or swipe.

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.

For remarks on dimensions see trackDimensions.

Note that this method is missing a newVisit parameter on purpose since it doesn't make sense to have an interaction without an impression first, and then the impression would mark the new visit, not the interaction.

Implementation

void trackContentInteraction({
  required Content content,
  required String interaction,
  String? pvId,
  String? path,
  Campaign? campaign,
  Map<String, String>? dimensions,
}) {
  return _track(
    MatomoAction(
      content: content,
      contentInteraction: interaction,
      pvId: _inferPvId(pvId),
      path: _inferPath(path),
      campaign: campaign,
      dimensions: dimensions,
    ),
  );
}