Consent management

All Viafoura analytics events are tracked by default. ViafouraSDK.setDataTrackingEnabled is the single switch that gates the analytics ingest pipeline, so pass your CMP's result into it. Call it with false to suspend tracking and true to grant (or restore) consent.

It's a plain in-memory flag, so it can be set before or after initialize(), and it is not persisted across app launches: re-apply the stored consent value on every launch.

import ViafouraSDK

// All events are tracked by default — no call is needed to opt in.
// Reflect the user's choice from your consent flow:
ViafouraSDK.setDataTrackingEnabled(hasUserConsented)

// Revoke at any time; no further analytics events are sent.
ViafouraSDK.setDataTrackingEnabled(false)

On iOS the SDK also reads the IDFA when tracking is enabled and the user has granted App Tracking Transparency authorization. With setDataTrackingEnabled(false), the IDFA is never read regardless of ATT status.


Did this page help you?