Skip to content

Customizing the CMP

The Predefined UI's main source for customization can be found in the "Appearance" section in the Admin Interface. There you will find two tabs:

Branding

In this section, you will be able to set a brand color, text font and size and logo via a URL.

Admin Interface

However, because not all fonts are supported by iOS and Android, consider using PredefinedUISettings to provide your custom font, as well as an image to be rendered as your logo, instead of fetching it from the internet.

let predefinedUISettings = PredefinedUISettings()
predefinedUISettings.customFont = UIFont(name: "myFont", size: 14) // The size will be ignored
predefinedUISettings.customLogo = UIImage(named: "AppLogo")

predefinedUI = usercentrics.getPredefinedUI(settings: predefinedUISettings) {}
val customFont =
    // Typeface.createFromAsset(assets, "my_font.ttf") // Font from 'assets/my_font.ttf'
    // ResourcesCompat.getFont(this, R.font.my_font)!! // Font from 'xml/my_font.xml'
    // Any other Typeface variable or provider

val customLogo = ImageResDrawable(R.mipmap.app_logo) // ImageResDrawable, ImageResBitmap, and ImageResUrl are supported

val predefinedUISettings = PredefinedUISettings(
    customFont = customFont,
    customLogo = customLogo
)

val arguments = UsercentricsActivityArguments(
    ...,
    predefinedUISettings = predefinedUISettings
)

usercentricsActivityLauncher.launch(arguments)
val customFont =
    // Typeface.createFromAsset(assets, "my_font.ttf") // Font from 'assets/my_font.ttf'
    // ResourcesCompat.getFont(this, R.font.my_font)!! // Font from 'xml/my_font.xml'
    // Any other Typeface variable or provider

val customLogo = ImageResDrawable(R.mipmap.app_logo) // ImageResDrawable, ImageResBitmap, and ImageResUrl are supported

val predefinedUISettings = PredefinedUISettings(
    customFont = customFont,
    customLogo = customLogo
)

val predefinedUI = usercentrics.getPredefinedUI(viewContext = myActivity, settings = predefinedUISettings) {}

Unity Customization Limitations

Font and Logo injection are currently not supported for Unity. You can only use the options available in the "Appearance" Section of the Admin Interface.

Supported image formats

The SDK only supports images provided via the Admin Interface in .png and .jpeg format, also, make sure that you have https instead of http. For performance reasons, we recommend you always use PredefinedUISettings to inject your logo, even if the URL image you provide is supported.

Feature Hierarchy

All PredefinedUISettings properties take priority over Admin Interface values.

Layout

In this section, you will be able to set a couple of layout options that are currently available for mobile:

Admin Interface

Hide Deny Button

True

True

Availability

This option can be set for GDPR (under first layer) and both TCF 2.0 layers.

Hide Language Switch

True

True

Availability

This option can be set for GDPR (under first layer) and CCPA (under first layer).

Feature Exception

If only one language is set as visible in the Admin Interface, the language switch will be hidden regardless of this feature.

Show Close Button

True

False

For the most part, your users will need to interact with the CMP on the first launch of your app, to collect their consent before enabling any frameworks that access user data. For this reason, the Predefined UI does not provide a dismiss button by default. So that users are forced to provide their consent choices.

However, once they have provided consent, you might want to allow them to revisit the CMP to review their consent. For this use case, we have provided a showCloseButton flag, that you can enable when creating your predefined UI, so that users are not forced to provide a new consent choice, in order to dismiss the CMP.

let predefinedUISettings = PredefinedUISettings()
predefinedUISettings.showCloseButton = false

predefinedUI = usercentrics.getPredefinedUI(settings: predefinedUISettings) {}
val predefinedUISettings = PredefinedUISettings(
    showCloseButton = true,
)

val arguments = UsercentricsActivityArguments(
    ...,
    predefinedUISettings = predefinedUISettings
)

usercentricsActivityLauncher.launch(arguments)
val predefinedUISettings = PredefinedUISettings(
    showCloseButton = true,
)

val predefinedUI = usercentrics.getPredefinedUI(viewContext = myActivity, settings = predefinedUISettings) {}

On your Usercentrics prefab/gameobject inspector, enable the Show Close Button checkbox. Show Close Button

Orientation Changes

Our Predefined UI only supports Portrait mode, Landscape mode is NOT supported.

Android Rotation

You can lock the orientation of the Activity that contains the Predefined UI in your Manifest file:

<activity android:name="com.usercentrics.sdk.UsercentricsActivity"
          android:screenOrientation="portrait" />
<activity android:name="{YourCustomActivity}"
          android:screenOrientation="portrait" />