dispatchInterval
The dispatchInterval() method sets a custom dispatch interval. It sets how often the SDK sends queued events to the tracker. Events are temporarily stored in a queue and sent in batches.
By default, the SDK dispatches queued events every 30 seconds.
Syntax
PiwikTracker.sharedInstance()?.dispatchInterval = seconds[PiwikTracker sharedInstance].dispatchInterval = seconds;Parameters
- dispatchInterval
number, required
The dispatch interval in seconds. Use0to send events immediately. Use-1to disable automatic dispatching and send events manually withdispatch().
Examples
To set the dispatch interval time to 60 seconds:
PiwikTracker.sharedInstance()?.dispatchInterval = 60[PiwikTracker sharedInstance].dispatchInterval = 60;To block sending events automatically and send it manually:
PiwikTracker.sharedInstance()?.dispatchInterval = -1
PiwikTracker.sharedInstance()?.sendException(description: "Content download error")
PiwikTracker.sharedInstance()?.dispatch()[PiwikTracker sharedInstance].dispatchInterval = -1;
[[PiwikTracker sharedInstance] sendExceptionWithDescription:@"Content download error"];
[[PiwikTracker sharedInstance] dispatch];This example uses sendException(description:) and dispatch() demonstrate manual dispatching.
Notes
- If multiple events are queued, the SDK sends them in a single request using the HTTP POST method with a JSON payload.
Related methods
Updated 2 months ago
Did this page help you?