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(dispatchInterval);

Parameters

seconds (number, required)

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

Examples

To set the dispatch interval time to 60 seconds:

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

Notes

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

Related methods