Event Batching
By default, VWO Flutter SDK sends impression events to VWO servers in real-time. This enables immediate tracking of visitor activity and conversions, with data instantly reflected in your VWO Campaign Reports.
However, there are scenarios where it may be beneficial to collect multiple events over a period of time and send them together in a single request. The VWO Flutter SDK supports event batching, allowing you to configure how and when impression events are uploaded to VWO servers.
Event Batching Configuration
You can enable event batching during SDK initialization by setting either of the following parameters:
Parameter | Description | Example |
---|---|---|
batchMinSize | Minimum number of events to trigger a batch upload. | 10 |
batchUploadTimeInterval | Time interval (in milliseconds) before a batch is uploaded. | 300000 |
Example Usage
import 'package:vwo_fme_flutter_sdk/vwo.dart';
import 'package:vwo_fme_flutter_sdk/vwo/models/vwo_init_options.dart';
final vwoInitOptions = VWOInitOptions(
sdkKey: "YOUR_SDK_KEY",
accountId: YOUR_ACCOUNT_ID,
batchMinSize: 10,
batchUploadTimeInterval: 300000,
);
// Create VWO instance with the vwoInitOptions
final vwoClient = await VWO.init(vwoInitOptions);
Note:The uploading of events will get triggered based on whichever condition is met first if using both options.
Offline Event Batching
The VWO Flutter SDK is designed to ensure that no impression events are lost, even when your users are offline. If the device loses internet connectivity, the SDK stores all impression events locally on the device. Once the device reconnects to the internet, these stored events are automatically uploaded to VWO servers in batches.
The SDK automatically handles offline event batching without requiring any additional configuration.
Important Notes
- Without event batching: Impression events are sent in real-time and reflected instantly in campaign reports.
- With event batching: Campaign reports are updated only after the batch is sent to VWO servers.
- Offline support: Events generated offline are stored locally and uploaded automatically when the device reconnects.
- Data Sync on Initialization: When the SDK initializes, it always syncs any stored data if present.
Updated 23 days ago