Skip to main content

Consent state

After the visitor decides, OptSens forwards the choice to Google Consent Mode and the attribution partners automatically (Consent forwarding). This page covers everything you run yourself: gate your own analytics and ad code on the visitor's choice, and read the IAB strings the SDK stored on the device.

Use OptSens.hasConsent to gate your own tracking. It returns the visitor's choice for a category, or the region's default before any decision (opt-out regions grant, opt-in regions deny).

if (OptSens.hasConsent("analytics")) {
// start your analytics
}

Categories: necessary (always granted), functional, analytics, advertising, performance.

IAB strings

The SDK writes the standard IAB keys to the device (IABTCF_*, IABGPP_*, IABUSPrivacy_*), so IAB-aware SDKs read consent on their own. You can also read the current strings directly:

OptSens.getTcString()
OptSens.getAdditionalConsent()
OptSens.getGppString()
OptSens.getUsPrivacyString()

OptSens.shouldCollectConsent() tells you whether the banner still needs to be shown (no decision yet, expired, or the vendor list changed).