Skip to content

Consent Handling

You can check the current consent status by calling:

let consentStatus = spConsentEngine.getConsentStatus(applicationId: "YOUR_APPLICATION_ID")

The SDK supports three consent states:

  • Collected: Consent has already been obtained.
  • Pending: Consent needs to be collected.
  • RecollectionRequired: Consent needs to be re-collected.

To check if a specific package has been marked as enabled by the user upon giving consent, you can call:

if let packageResult = spConsentEngine.getPackage(applicationId: "YOUR_APPLICATION_ID", packageId: "Package-Id-To-Find") {
if let spPackage = packageResult.data as? SPPackageConsent {
if spPackage.enabled() {
//enable features
}
}
}

This would return a SPDataMessage containing the SPMobilePackage only if the user has consented. Otherwise, it would return null.

To launch the consent collection popup, use the following method:

consentEngine?.showConsentBanner(in: self)

This popup will inform users about the SDK and provides them with options to agree to all, deny to all or customise their consent preferences.

Additionally, you can call the following method to display the secondary consent banner:

spConsentEngine.showSecondary(in: self);

Users have the option to customize their preferences. When they click the customization button, they will be directed to the Preference Center, where they can:

  • View a list of frameworks and their services.
  • Enable or disable consent for specific services.

To display the preference center directly, simply call:

spConsentEngine.showPreferenceCenter(applicationId: "YOUR_APPLICATION_ID", in: self)

You can mark certain services as essential. These services will not be optional for the user to deny, ensuring compliance with the app’s required functionalities.

The Preferences screen also includes tabs showcasing content related to the app’s privacy and cookie policies. This ensures users have access to essential information regarding their data handling.

Users can submit a request for their data by filling out a form in the Request Data section. This feature helps manage user data requests in compliance with privacy regulations.