By default, the Android SDK sends tracking requests individually. If you want to reduce the number of network calls, you can enable batch support and let the SDK send cached requests in groups.
Batching can help reduce bandwidth and battery usage while preserving the chronological order of requests.
When to use batch support
Use it when your app records many tracking events and you want to reduce the number of outgoing requests.
Keep the default behavior if you do not have a specific reason to batch requests.
Enable batch support
Use setBatchSupport(batchEnable, requestsInBatch) on the configuration builder.
val configuration = WebtrekkConfiguration.Builder(
trackIds = listOf("11111111111111111"),
trackDomain = "https://your-trackdomain.com"
)
.setBatchSupport(true, 5000)
.build()
Webtrekk.getInstance().init(this, configuration)WebtrekkConfiguration configuration = new WebtrekkConfiguration.Builder(
Arrays.asList("11111111111111111"),
"https://your-trackdomain.com"
)
.setBatchSupport(true, 5000)
.build();
Webtrekk.getInstance().init(this, configuration);Configuration details
Setting | Description |
|---|---|
|
|
| The number of cached requests the SDK includes in one batch. The SDK default is |
If the number of cached requests exceeds the configured batch size, the SDK sends multiple batches until the queue is processed.
Notes
Batch support is disabled by default.
The SDK default batch size is
5000requests per batch.If you use batching and rely on accurate timing analysis, enabling the client timestamp is recommended.
Related: Configure Global Tracking, Configure WorkManager Constraints