When Consent Changes
Overview
When a user updates their consent choices or interacts with the OT SDK UI, the application needs to become aware so that it can control the next set of actions like:
- Allowing or restricting processing of 3rd party SDKs based on their categorization
- Passing latest user consent values to 3rd Party SDKs
- Passing the IAB's encoded TC String to 3rd party SDKs
- Passing the IAB's USP String to 3rd Party SDKs
- Routing the User to another location in the App
- Displaying messages to the User of their changes
- Logging updates to internally owned APIs
- etc...
Querying For Consent
Query the current consent status for any of the categories included in your application. This can be used to determine what privacy action is needed at the time of query and can also be coupled with an event listener. Simply pass in the Category ID (eg. C0001) and the method will return the current consent status (integer value).
Value Returned
- 1 = Consent is given
- 0 = Consent is not given
- -1 = Consent has not been collected (The SDK is not initialized or category does not exist OR there are no SDKs associated to this category)
m.global.OTsdk.callFunc("getConsentStatusForGroupID","C0001")
m.global.OTsdk.callFunc("getConsentStatusForGroupID","C0002")
m.global.OTsdk.callFunc("getConsentStatusForGroupID","C0003")
m.global.OTsdk.callFunc("getConsentStatusForGroupID","C0004")
m.global.OTsdk.callFunc("getConsentStatusForGroupID","C0005")
Listening for Consent Updates
When consent is updated, the "onSdkBroadCast" field is updated. This can be observed with a callback, where the consent status is then queried.
m.global.OTsdk.observeField("onSdkBroadCast","onBroadCastChange")
function onBroadCastChange()
sdkStatus = m.global.OTsdk.callFunc("getConsentStatusForGroupID","C0002")
print "sdkStatus -> " sdkStatus
end function
Listening for UI Events
There are several functions inside of OTInitialize.brs
where you can add logic to action consent. Using the query function above, you can find the state of each category inside of these functions if required.
Function | Usage |
---|---|
onAcceptAll() | Called when an "Accept All" button is pressed. Append actioning logic to the bottom of this function. |
onRejectAll() | Called when a "Reject All" button is pressed. Append actioning logic to the bottom of this function. |
onPreferenceCenterConfirmChoices() | Called when "Confirm Choices" is selected int he preference center. Add actioning logic to the bottom of this function, querying for consent values as necessary. |
Updated 9 months ago