setDispatchInterval

The setDispatchInterval() method sets a custom dispatch interval time. Tracked events are temporarily stored in a queue and dispatched in batches. The default dispatch interval time is 30 seconds – batches are sent every 30 seconds.

Syntax

const dispatchInterval = 25; // 25 seconds
await PiwikProSdk.setDispatchInterval(seconds);

Parameters

seconds (number, required)

The interval time (in seconds) for dispatching tracked events. If 0 seconds, events will be sent right away. If -1 seconds, events won’t be sent automatically and can be send manually.

Examples

To set the dispatch interval time to 60 seconds:

const dispatchInterval = 25; // 25 seconds
await PiwikProSdk.setDispatchInterval(60);

Notes

  • If more than one event is queued, the data is sent in bulk using the POST method with a JSON payload.

Realated methods