dispatch
The dispatch() method sends queued Analytics events to the tracker. One call may use several HTTP requests when the backlog is larger than eventsPerRequest; each of those requests carries at most that many events.
With optOut enabled, the SDK does not store new events, but dispatch() can still upload events that were queued before opt-out. To drop that backlog without sending, use deleteQueuedEvents().
Syntax
PiwikTracker.sharedInstance()?.dispatch()[[PiwikTracker sharedInstance] dispatch];Examples
To configure the tracker so events are not dispatched automatically and trigger a manual dispatch:
PiwikTracker.sharedInstance()?.dispatchInterval = -1
PiwikTracker.sharedInstance()?.sendEvent(
category: "Clicks",
action: "Button",
name: "Sign up",
value: 100,
path: "/main/signup"
)
PiwikTracker.sharedInstance()?.dispatch()[PiwikTracker sharedInstance].dispatchInterval = -1;
[[PiwikTracker sharedInstance] sendEventWithCategory:@"Clicks"
action:@"Button"
name:@"Sign up"
value:@100
path:@"/main/signup"];
[[PiwikTracker sharedInstance] dispatch];Notes
dispatchIntervalcontrols how often the SDK startsdispatch()on its own (default 30 s;-1means only manualdispatch()).eventsPerRequestcaps how many queued Analytics events go into one HTTP request during a dispatch. When the backlog is bigger, onedispatch()still does several requests (see above).maxNumberOfQueuedEventscaps how many events can be held in local storage; above that, new events may be dropped until space frees up after a successful send.
Related methods
Updated 15 days ago