At a glanceThe Apsalar SDK by default sends all session and event data in real-time, ensuring minimal data loss and data recency in real-time reports. There are cases however that an application developer would prefer to batch Apsalar event calls to optimize data bandwidth and application performance. The Apsalar iOS SDK provides a number of methods to enable and control batching of events.
Enabling event batchingEvent batching is disabled by default and all events are sent in real-time. To enable or disable event batching, use the following method:
Modifying event batching settingsThe SDK batches all events within a specified time interval, to be sent at the end of the time interval before starting a new batch for the next time interval.
The default time interval for the batch is 30 seconds. To modify this time interval, use the following method:
Where interval is an integer in the range of 0 to 3600. An interval of 0 will send data in real-time.
In addition to the regular batching of events with the specified time interval,
- To ensure timely reporting for critical data points, the following API calls are excluded from the batch and are sent in real-time: start session, restart session, end session, In-app purchase events.
- Upon ending a session, the SDK will send all remaining batches before the application exits.
- If a batch cannot be sent before the session terminates, it will be sent immediately after the next session is started.
- Each event call includes a timestamp and a session ID and as such will be attributed to the date and session when the event occurred.
Manually send a batchIn the event a batch needs to be sent immediately, use the following method to send all outstanding batches and start a new batch: