trackException

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

Syntax

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

Parameters

description (string, required)

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: { 1: { name: 'name', value: 'value' } },
  customDimensions: { 1: 'value', 2: 'value' },
};
await PiwikProSdk.trackException('Download error', options);