trackSocialInteraction

The trackSocialInteraction() method records likes, shares and comments on social media on your app.

Syntax

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

Parameters

interaction (string, required)

The interaction type. Example: like, share, comment.

network (string, required)

The social media for which the interaction happened. Example: Facebook, Instagram, YouTube.

options

Social interaction options: an object containing two properties.

customDimensions

An object that specifies custom dimensions.

visitCustomVariables

An object that specifies visit custom variables.

Examples

To track a Facebook like on your app:

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