Universal Consent Purposes Helpers

OneTrust SDK Public Methods for Universal Consent Purposes (UCP)

Existing

Display OneTrust UCP UI

This API will display the OT SDK Consent Purposes UI.

OTPublishersHeadlessSDK.shared.showConsentPurposesUI(\_:)

Please call this method only after setupUI() method has been called at least once in the current app launch. Make sure that the OT SDK Data is downloaded prior to calling this API.

Note: This method doesn't consider value of shouldShowBanner.

Updating consent for individual UC purpose

Public function to update consent status for specified UCP purpose id.

Parameters:

  • purposeId: String purpose Id for which consent status should be change.
  • value: Boolean value specifying updated consent value (true or false)
OTPublishersHeadlessSDK.shared.updateUCPurposeConsent(purposeId:, withConsent:)

Updating consent for individual custom preference associated with an UC purpose

Public function to update consent status for specified UCP custom preference option id.

OTPublishersHeadlessSDK.shared.updateUCPurposeConsent(cpOptionId:, cpId:, purposeId:, withConsent:)

Parameters:

  • cpOptionId: String custom preference option id for which consent status should be change.
  • cpId: String custom preference id related with custom preference option id.
  • purposeId: String purpose id related with custom preference id.
  • value: Boolean value specifying updated consent value (true or false)

Get consent status of a UC Purpose

Public function to get consent status for specified UCP purpose id.

Parameter:

  • purposeID: String purpose Id for which consent status will be returned.
OTPublishersHeadlessSDK.shared.getUCPurposeConsent(purposeID:) -> Int

Return:

  • 1 = consent given
  • 0 = consent not given
  • -1 = if invalid purpose ID is passed

Get consent status of a custom preference associated with an UC Purpose

Public function to get consent status for an Option of the Custom preference under a given UCPurpose.

Parameters:

  • customPreferenceOptionID: String Option ID under a given custom preference for which consent status will be returned.
  • customPreferenceID: String custom preference id to which Option ID belongs to.
  • purposeID: String purpose id of the custom preference, to which the given Option ID belongs to.
OTPublishersHeadlessSDK.shared.getUCPurposeConsent(customPreferenceOptionID:, customPreferenceID:, purposeID:) -> Int

Return:

  • 1 = if consent given
  • 0 = if consent not given
  • -1 if invalid customPreferenceOptionID/customPreferenceID/purposeID is passed.

New (starting 202504.1.0)

Download OneTrust UCP data

This method retrieves the UC Purposes data from the CMP API.

Parameter:

  • completion: The completion contains the UCP response represented as a dictionary.

Note: If the data is already fetched, the network call will not be made.

OTPublishersHeadlessSDK.shared.fetchUCPurposesCmpApiData(completion:)

Deprecated (starting 202504.1.0)

Update consent status for UCP Topic Option ID

Public function to update consent status for specified UCP topic option id.

Parameters:

  • topicOptionId: String topic option id for which consent status should be change.
  • purposeId: String purpose id related with specified topic option id for which consent status should be change.
  • value: Boolean value specifying updated consent value (true or false)
OTPublishersHeadlessSDK.shared.updateUCPurposeConsent(topicOptionId:, purposeId:, withConsent:)

Deprecation Message: Topics have now been deprecated in UCP.

Get consent status for UCP Topic Option ID

Public function to get consent status for specified UCP purpose id.

Parameters:

  • purposeID: String purpose Id for which consent status will be returned.

Return:

  • 1 = if consent given
  • 0 = if consent not given
  • -1 = if invalid purpose ID is passed
OTPublishersHeadlessSDK.shared.getUCPurposeConsent(topicID:, purposeID:) -> Int

Deprecation Message: Topics have now been deprecated in UCP.