Tracking Control
Consent: SDK-level toggle and per-call tracking override
Two independent axes control whether the SDK sends outbound tracking events: an SDK-level toggle and a per-call override. Use them to honor consent without losing your experiment logic — bucketing, rule evaluation, sticky persistence, and goal dedup keep working regardless of the tracking state. Only the network side is silenced.
SDK-level toggle (dynamic)
sdk.setTrackingEnabled(false) // e.g. on consent withdrawal
// ...
sdk.setTrackingEnabled(true) // e.g. on consent re-grant
val current = sdk.isTrackingEnabled()When tracking is false, every bucketing/conversion enqueue is a no-op — events are not enqueued. This means:
- Events generated while disabled are lost — there is no silent buffer that replays on re-enable.
- Events already on the queue from before the disable continue flushing through the normal timer/batch mechanism.
- Re-enabling with
setTrackingEnabled(true)only re-opens the gate for subsequent events; it does not recover events generated while disabled and does not force an immediate flush.
Boot-time variant
Set the initial state at build time when consent is unknown at launch:
ConvertSDK.builder(context)
.sdkKey("YOUR_SDK_KEY")
.trackingEnabled(false) // start silent; flip on once consent resolves
.build()Flip it later with sdk.setTrackingEnabled(true).
Per-call override
Suppress the event for a specific decision call with enableTracking = false:
val variation = ctx.runExperience("homepage-redesign", enableTracking = false)
ctx.runExperiences(enableTracking = false)When enableTracking = false, bucketing, sticky persistence, audience rules, and the internal bucketing event still fire — only the outbound network event is skipped.
How the two axes combine
The SDK-level toggle is an AND gate over the per-call flag: an event ships only when both are true. A per-call enableTracking = false therefore suppresses this event regardless of the SDK-level state.
| SDK-level | Per-call | Event shipped? |
|---|---|---|
true | true (default) | Yes |
true | false | No |
false | true | No |
false | false | No |
Consent scenarios
| Scenario | What to do |
|---|---|
| Consent unknown at launch | .trackingEnabled(false) in the builder; flip to true after the consent dialog resolves. |
| Consent withdrawn mid-session | sdk.setTrackingEnabled(false). The in-flight queue drains; new events stay silent. |
| Consent per-feature | Keep the SDK-level toggle true and pass enableTracking = false on the specific calls you want silent. |
Relationship to the offline queue
Disabling tracking stops events from being enqueued. It does not flush or clear events already persisted offline — those continue through the normal delivery path. See Offline Behavior.
Related pages
- Configuration Options — the
trackingEnabledbuilder option - Google Play Data Safety — what data the SDK collects when tracking is on
- Tracking Conversions — the shared conversion concept doc
Updated 2 days ago