trackOutlink

The trackOutlink() method records clicks on links to external websites or apps (different domains).

Syntax

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

Parameters

outlink (string, required)

The outlink. Example: https://example.com.

options

Goal options: an object containing two properties.

customDimensions

An object that specifies custom dimensions.

visitCustomVariables

An object that specifies visit custom variables.

Examples

To track an outlink to https://example.com:

const options = {
  visitCustomVariables: { index: { name: 'name', value: 'value' },
  customDimensions: { dimensionID: 'value', dimensionID: 'value', },
};
await PiwikProSdk.trackOutlink(`https://example.com`, options);