Customize User Interfaces (Optional)

Overview

As most UI configurations are primarily made from the OneTrust tenant, this section is optional. If your app has a use case where it needs to make additional configurations (e.g. font family) otherwise not available to be configured in the tenant or if it needs to control the UI configurations locally, you can use this custom configuration functionality.

UI elements are configured through a plist supplied by OneTrust. See the Sample App for a demo.

Import the Custom UI Property List

  1. Download the Sample App from your tenant. Steps here.
  2. After unzipping the file:
    1. Access the OTPublishersHeadlessSDK-XCFramework
    2. Select your corresponding file (if tvOS, select OTPublishersHeadlessSDKtvOS. If iOS, select the other one)
    3. Select OTPublishersHeadlessSDK.xcframework > ios-arm64
    4. OTPublishersHeadlessSDK.framework > OTSDK-UIConfig-iOS.plist

tvOS will follow the same steps but with tvos file labels.

  1. Copy the plist file into your app. Select 'Copy items if needed' to ensure the plist is added to the application folder hierarchy.
  2. Edit the UI elements in the plist as necessary.

👍

Do not add any rows or change the keys itself in the plist. Only change the values of existing properties.

Styles set in the plist will be given priority over server values when rendering the UI if the custom config property is set.

Configure the SDK

  1. As part of the UIConfigurator protocol, set shouldUseCustomUIConfig() to true.
  2. As part of the UIConfigurator protocol, conform to customUIConfigFilePath().
    1. While conforming to this method, provide the path to the plist.
//iOS and tvOS

//Conform to this in order to customize the UI locally
OTPublishersHeadlessSDK.shared.uiConfigurator = self

extension AppDelegate: UIConfigurator {
    func shouldUseCustomUIConfig() -> Bool {
      return true
    }
    
    func customUIConfigFilePath() -> String? {
      //path to plist file
      let customPath = Bundle.main.path(forResource: "OTSDK-UIConfig-iOS", ofType: "plist")
      return customPath
    }
}

Customize the UI

This section describes the UI elements that can be configured.

Table of contents:

  1. Customizing the Global Theme
  2. Customizing the Navigation Bar
  3. Customizing the Banner View
  4. Customizing the Preference Center View
  5. Customizing the Purpose Details View
  6. Customizing the Vendor List View
  7. Customizing the Vendor Details View
  8. Customizing the SDK List View
  9. Customizing the App Tracking Transparency Pre and Settings Prompt View
  10. Custom Fonts

Customizing the Global Theme

All global theme related customizations are listed under globalTheme. This is a common theme that will be applied across all UI views.

The following are the customizations available:

UI ElementKey NameTypeDescription
LinksshouldUnderlineLinkBooleanUnderlines links or not
Link ColorlinkColorStringHex code. Styles the color of the links

Customizing Page Headers (Navigation Bar)

All page header related customizations are listed underpageHeader in the plist. This is a common theme that will be applied to all the SDK view navigation bars.

The following are the customizations available:

UI ElementKey NameTypeDescription
Text ColortextColorStringHex code. Styles the color of the text
Font NamefontNameStringStyles the font of the text
Tint ColortintColorStringHex code. Styles the tint color of the page header/nav bar
Background ColorbackgroundColorStringHex code. Styles the background color of the page header/nav bar
Font Text StylefontTextStyleStringStyles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below
Font SizefontSizeIntStyles the size of the font
Font Text Style Options
largeTitle
title1
title2
title3
headline
subheadline
body
callout
footnote
caption1
caption2

📘

Note

  • When a custom fontName is provided, at least one of the fontSize or fontTextStyle should also be provided in order for it to reflect.
  • In order for dynamic font sizes to be supported, the application will have to provide a valid value for fontTextStyle if customizing the fonts.

Customizing the Banner UI

All banner view related customizations are listed under bannerTheme in the plist.

The following are the customizations available for the Banner View:

UI ElementKey NameTypeDescription
LinksTop level: links

policyLink

vendorList
DictionaryStyles the Privacy Policy or Vendors List link
Background ColorbackgroundColorStringStyles the background color of the banner view
ButtonsTop level: buttons

closeButton

acceptAll

rejectAll

showPreferences
DictionaryStyles the close ('x'), accept all, reject all, and manage settings CTAs
SummaryTop level: summary

title

description
DictionaryStyles the title and description text of the banner view

Here's a list of possible UI styles that can be changed under each applicable element above:

UI ElementKey NameTypeDescription
Text ColortextColorStringHex code. Styles the color of the text
Font NamefontNameStringStyles the font of the text
Text AlignmenttextAlignmentStringStyles the alignment of the text
Tint ColortintColorStringHex code. Styles the tint color of the page
Font Text StylefontTextStyleStringStyles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below
Font SizefontSizeIntStyles the size of the font
Border RadiusborderRadiusStringStyles the border radius of the CTA
Border WidthborderWidthStringStyles the border width of the CTA
Border ColorborderColorStringStyles the border color of the CTA
Font Text Style Options
largeTitle
title1
title2
title3
headline
subheadline
body
callout
footnote
caption1
caption2

📘

Note

  • When a custom fontName is provided, at least one of the fontSize or fontTextStyle should also be provided in order for it to reflect.
  • In order for dynamic font sizes to be supported, the application will have to provide a valid value for fontTextStyle if customizing the fonts.

Customizing the Preference Center UI

All preference center view related customizations are listed under preferenceCenterTheme in the plist.

The following customizations are available for the Preference Center View:

UI ElementKey NameTypeDescription
SummaryTop level: summary

title

description
DictionaryStyles the text of the title and description
ButtonsTop level: buttons

acceptAll

rejectAll

confirmMyChoice

closeButton
DictionaryStyles the accept, reject, close, and confirm choices CTAs
Purposes Always Active StatuspurposesAlwaysActiveStatusDictionaryStyles the always active text of the strictly necessary categories
Purpose TitlepurposeTitleDictionaryStyles the text of the OneTrust categories/IAB purposes
Show Logo on PCshowLogoOnPCBooleanDisplay/not display a logo
LinksTop level: links

policyLink

vendorList
DictionaryStyles the Privacy Policy or Vendor List link
Right Chevron ColorrightChevronColorStringHex code. Styles the color of the chevron or 'arrow' to the right of each category/purpose
Line Break ColorlineBreakColorStringHex code. Styles the lines separating each category/purpose (if enabled)
Toggle ColortoggleColorStringHex code. Styles the toggle color when toggled ON
Background ColorbackgroundColorStringHex code. Styles the background color of the preference center view

Here's a list of possible UI styles that can be changed under each applicable element above:

UI ElementKey NameTypeDescription
Text ColortextColorStringHex code. Styles the color of the text
Font NamefontNameStringStyles the font of the text
Text AlignmenttextAlignmentStringStyles the alignment of the text
Tint ColortintColorStringHex code. Styles the tint color of the page
Font Text StylefontTextStyleStringStyles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below
Font SizefontSizeIntStyles the size of the font
Border RadiusborderRadiusStringStyles the border radius of the CTA
Border WidthborderWidthStringStyles the border width of the CTA
Border ColorborderColorStringStyles the border color of the CTA
Font Text Style Options
largeTitle
title1
title2
title3
headline
subheadline
body
callout
footnote
caption1
caption2

📘

Note

  • When a custom fontName is provided, at least one of the fontSize or fontTextStyle should also be provided in order for it to reflect.
  • In order for dynamic font sizes to be supported, the application will have to provide a valid value for fontTextStyle if customizing the fonts.

Customizing the Purposes Details UI

All purpose detail view related customizations are listed under purposeDetailsTheme in the plist.

The following customizations are available for the Purpose Details View:

UI ElementKey NameTypeDescription
Group SummaryTop level: groupSummary

title

description
DictionaryStyles the title and description
Always Active StatusalwaysActiveStatusDictionaryStyles the 'always active' text of purposes that cannot be disabled
Consent TitleconsentTitleDictionaryStyles the 'Consent' toggle title for IAB purposes
Legitimate Interest TitlelegitInterestTitleDictionaryStyles the 'Legitimate Interest' toggle title for IAB purposes
LinksTop level: links

sdkList

vendorList

fullLegalText
DictionaryStyles the SDK List, Vendor List, and View Illustrations link
Line Break ColorlineBreakColorStringHex code. Styles the lines separating each category/purpose (if enabled)
Background ColorbackgroundColorStringHex code. Styles the background color of the purpose details view
Toggle ColortoggleColorStringHex code. Styles the toggle color when toggled ON

Here's a list of possible UI styles that can be changed under each applicable element above:

UI ElementKey NameTypeDescription
Text ColortextColorStringHex code. Styles the color of the text
Font NamefontNameStringStyles the font of the text
Text AlignmenttextAlignmentStringStyles the alignment of the text
Tint ColortintColorStringHex code. Styles the tint color of the page
Font Text StylefontTextStyleStringStyles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below
Font SizefontSizeIntStyles the size of the font
Font Text Style Options
largeTitle
title1
title2
title3
headline
subheadline
body
callout
footnote
caption1
caption2

📘

Note

  • When a custom fontName is provided, at least one of the fontSize or fontTextStyle should also be provided in order for it to reflect.
  • In order for dynamic font sizes to be supported, the application will have to provide a valid value for fontTextStyle if customizing the fonts.

Customizing the Vendor List UI

All vendor list view related customizations are listed under vendorListTheme in the plist.

The following customizations are available for the Vendor List View:

UI ElementKey NameTypeDescription
Line Break ColorlineBreakColorStringHex code. Styles the lines separating each vendor (if enabled)
Filter Item TitlefilterItemTitleDictionaryStyles the titles available in the filter list
Background ColorbackgroundColorStringHex code. Styles the background color of the vendor list view
Filter Off ColorfilterOffColorStringHex code. Styles the filter color when no filter is applied
ButtonsTop level: buttons

confirmMyChoices

applyFilter
DictionaryStyles the apply and confirm choices CTAs of the vendor list
Filter On ColorfilterOnColorStringHex code. Styles the filter icon color when filter is applied
Filter Selection ColorfilterSelectionColorStringHex code. Styles the tint color of the check mark in the vendor filter list
Toggle ColortoggleColorStringHex code. Styles the vendor list toggle color when toggled ON
TitletitleDictionaryStyles the navigation tab bar titles and titles of each vendor in the vendor list
Filter Navigation TextfilterNavTextDictionaryStyles the 'cancel' CTA of the filter list in the vendor list UI
Right Chevron ColorrightChevronColorStringHex code. Styles the color of the chevron or 'arrow' to the right of each vendor
Search BarsearchBarDictionaryStyles the search bar section of the vendor list view

Here's a list of possible UI styles that can be changed under each applicable element above:

UI ElementKey NameTypeDescription
Text ColortextColorStringHex code. Styles the color of the text
Font NamefontNameStringStyles the font of the text
Text AlignmenttextAlignmentStringStyles the alignment of the text
Tint ColortintColorStringHex code. Styles the tint color of the page
Font Text StylefontTextStyleStringStyles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below
Font SizefontSizeIntStyles the size of the font
Border RadiusborderRadiusStringStyles the border radius of the CTA
Border WidthborderWidthStringStyles the border width of the CTA
Border ColorborderColorStringStyles the border color of the CTA
Font Text Style Options
largeTitle
title1
title2
title3
headline
subheadline
body
callout
footnote
caption1
caption2

📘

Note

  • When a custom fontName is provided, at least one of the fontSize or fontTextStyle should also be provided in order for it to reflect.
  • In order for dynamic font sizes to be supported, the application will have to provide a valid value for fontTextStyle if customizing the fonts.

Customizing the Vendor Details UI

All vendor list view related customizations are listed under vendorDetailsTheme in the plist.

The following UI Elements are the customizations available for the Vendor Details View:

UI ElementKey NameTypeDescription
Consent TitleconsentTitleDictionaryStyles the title of the 'consent' label
Details SummaryTop level: detailsSummary

title

description
DictionaryStyles the title and description of the vendor details
Legitimate Interest TitlelegitInterestTitleDictionaryStyles the 'legitimate interest' label
LinksTop level: links

privacyNotice
DictionaryStyles the privacy notice link of the vendor
TitletitleDictionaryStyles the title of the vendor details page
Background ColorbackgroundColorStringHex code. Styles the background color of the vendor details UI page
Toggle ColortoggleColorStringHex code. Styles the vendor details UI toggle color when toggled ON

Here's a list of possible UI styles that can be changed under each applicable element above:

UI ElementKey NameTypeDescription
Text ColortextColorStringHex code. Styles the color of the text
Font NamefontNameStringStyles the font of the text
Text AlignmenttextAlignmentStringStyles the alignment of the text
Tint ColortintColorStringHex code. Styles the tint color of the page
Font Text StylefontTextStyleStringStyles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below
Font SizefontSizeIntStyles the size of the font
Border RadiusborderRadiusStringStyles the border radius of the CTA
Border WidthborderWidthStringStyles the border width of the CTA
Border ColorborderColorStringStyles the border color of the CTA
Font Text Style Options
largeTitle
title1
title2
title3
headline
subheadline
body
callout
footnote
caption1
caption2

📘

Note

  • When a custom fontName is provided, at least one of the fontSize or fontTextStyle should also be provided in order for it to reflect.
  • In order for dynamic font sizes to be supported, the application will have to provide a valid value for fontTextStyle if customizing the fonts.

Customizing the SDK List UI

All SDK List view related customizations are listed under sdkListTheme in the plist.

The following UI Elements are the customizations available for the SDK List View:

UI ElementKey NameTypeDescription
SummaryTop level: summary

title

description
DictionaryStyles the title and description of the SDK List view
Search BarsearchBarDictionaryStyles the search bar field of the SDK List view
Filter OFF ColorfilterOffColorStringHex code. Styles the filter element when filters are not in use
Filter ON ColorfilterOnColorStringHex code. Styles the filter element when filters are in use
Filter ListTop level: filterList

sdkItem

buttons

navItem

selectionColor
DictionaryStyles the elements in the filter list
Line Break ColorlineBreakColorStringHex code. Styles the lines separating each filter list item
Background ColorbackgroundColorStringHex code. Styles the background color of the filter list

Here's a list of possible UI styles that can be changed under each applicable element above:

UI ElementKey NameTypeDescription
Text ColortextColorStringHex code. Styles the color of the text
Font NamefontNameStringStyles the font of the text
Text AlignmenttextAlignmentStringStyles the alignment of the text
Tint ColortintColorStringHex code. Styles the tint color of the page
Font Text StylefontTextStyleStringStyles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below
Font SizefontSizeIntStyles the size of the font
Border RadiusborderRadiusStringStyles the border radius of the CTA
Border WidthborderWidthStringStyles the border width of the CTA
Border ColorborderColorStringStyles the border color of the CTA
Font Text Style Options
largeTitle
title1
title2
title3
headline
subheadline
body
callout
footnote
caption1
caption2

📘

Note

  • When a custom fontName is provided, at least one of the fontSize or fontTextStyle should also be provided in order for it to reflect.
  • In order for dynamic font sizes to be supported, the application will have to provide a valid value for fontTextStyle if customizing the fonts.

Customizing the App Tracking Transparency Pre and Settings Prompt

All ATT pre and settings prompt view related customizations are listed under permissionConsentTheme in the plist.

The following UI Elements are the customizations available for the ATT Prompt View:

UI ElementKey NameTypeDescription
ButtonsTop level: buttonsTheme

cancelConsent

giveConsent
DictionaryStyles the CTAs of the pre and settings prompt. In the settings prompt, giveConsent styles the 'Settings' CTA and cancelConsent styles the 'Not Now' CTA
Background ColorbackgroundColorStringHex code. Styles the background color of the pre and settings prompt
Title and Description StylesTop level: consentSummaryTheme

title

description
DictionaryStyles the title and description of the pre and settings prompt
Title and Description ContentTop level: idfaConsentViewText

giveConsentMode

changeConsentMode
DictionaryUpdates the text/content of the pre and settings prompt. giveConsentMode refers to the pre prompt and changeConsentMode refers to the settings prompt

Here's a list of possible UI styles that can be changed under each applicable element above:

UI ElementKey NameTypeDescription
Text ColortextColorStringHex code. Styles the color of the text
Font NamefontNameStringStyles the font of the text
Text AlignmenttextAlignmentStringStyles the alignment of the text
Tint ColortintColorStringHex code. Styles the tint color of the page
Font Text StylefontTextStyleStringStyles the text style of the font (e.g. headline, callout, sub headline, etc.). See a list of supported text styles in the table below
Font SizefontSizeIntStyles the size of the font
Border RadiusborderRadiusStringStyles the border radius of the CTA
Border WidthborderWidthStringStyles the border width of the CTA
Border ColorborderColorStringStyles the border color of the CTA
Font Text Style Options
largeTitle
title1
title2
title3
headline
subheadline
body
callout
footnote
caption1
caption2

📘

Note

  • When a custom fontName is provided, at least one of the fontSize or fontTextStyle should also be provided in order for it to reflect.
  • In order for dynamic font sizes to be supported, the application will have to provide a valid value for fontTextStyle if customizing the fonts.

Custom Fonts

To change the font:

  1. Add custom fonts to Xcode (if custom): Apple documentation
  2. Reference the font in the fontName key of the plist. Ensure you specify a fontSize for the custom font to take effect.