dispatch
The dispatch() method sends queued analytics events to the tracker.
If the queue contains more events than the value configured in eventsPerRequest, the SDK sends them in multiple HTTP requests. Each request contains up to the configured number of events.
When optOut is enabled, the SDK does not store new events. However, dispatch() can still send events that were queued before opt-out was enabled.
To delete those queued events without sending them, use deleteQueuedEvents().
Syntax
PiwikTracker.sharedInstance()?.dispatch()[[PiwikTracker sharedInstance] dispatch];Examples
To disable automatic dispatching, do the following:
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 automatically callsdispatch()(default: 30 s). Set it to-1to send events only through manualdispatch()calls.eventsPerRequestlimits the number of queued analytics events sent in a single HTTP request. If more events are queued, a singledispatch()call sends multiple requests (see above).maxNumberOfQueuedEventslimits the number of events the SDK can store in local storage. When the limit is reached, new events may be dropped until previously queued events are sent successfully.
Related methods
Updated 2 months ago
Did this page help you?