trackException

The trackException() method records caught exceptions (errors) in your app. For each exception, you need to define handling code.

Syntax

const options = {
  visitCustomVariables: { index: { name: 'name', value: 'value' },
  customDimensions: { dimensionID: 'value', dimensionID: 'value', },
};
await PiwikProSdk.trackException('description', options);

Parameters

description (string, optional)

Additional information about the issue.

options

Exception options: an object containing two properties.

customDimensions

An object that specifies custom dimensions.

visitCustomVariables

An object that specifies visit custom variables.

Examples

To send a caught exception:

const options = {
  visitCustomVariables: { index: { name: 'name', value: 'value' },
  customDimensions: { dimensionID: 'value', dimensionID: 'value', },
};
await PiwikProSdk.trackException('Download error', options);