trackScreen

The trackScreen() method records a screen view on your mobile app. The screen view is similar to the page view on a website.

Syntax

const options = {
  title: 'title',
  customDimensions: { dimensionID: 'value', dimensionID: 'value', },
};
await PiwikProSdk.trackScreen(`path`, options);

Parameters

path (string, required)

The path set for your screen. Example: example/welcome.

options

Exception options: an object containing two properties.

title (string, optional) (deprecated)

The title set for your screen. Available on Android only. Example: Welcome.

❗️

Deprecated

This parameter will be removed soon. We recommend not using it.

customDimensions

An object that specifies custom dimensions.

screenCustomVariables

An object that specifies screen custom variables.

visitCustomVariables

An object that specifies visit custom variables.

Examples

To send a screen view with the path example/welcome:

const options = {
  title: 'title',
  customDimensions: { dimensionID: 'value', dimensionID: 'value', },
};
await PiwikProSdk.trackScreen(`example/welcome`, options);