Display User Interfaces

Overview

The OneTrust SDK manages several different user interfaces to display to a user. Before showing how to display them, please review the list of interfaces below.

CMP Views

ViewDescription
BannerNotice to the user of their privacy rights. It has configurable text and buttons for Accept All, Reject All, Manage Preferences, and Close Banner.

📘 Note

Each of these buttons can be toggled on/off in the Admin Console.
Preference CenterAn interface for the user to view their current profile settings and update their choices based on the configuration provided for them. It has configurable text and buttons for Accept All, Reject All, Save Settings, and Close Preference Center.

📘 Note

You can choose to hide each button except the Save Settings button. This one is required for users to update their choices.
Purpose DetailsSub-view of the Preference Center. Displays more details about the purpose. It will display child purposes and links to Vendor List and SDK List if configured.
SDK ListAn interface to show a granular list of SDKs to the user. This list may be filtered by category to provide more transparency to the user.

📘 Note

This can be hidden in Template Settings in the Admin Console.
Vendor ListAn interface, shown only for IAB2 type templates that displays a list of both IABand Google vendors in scope of the application. This provides a way for users to opt in/out of consent for a particular vendor.
Vendor DetailsA child interface of Vendor List, that shows more granular information about a vendor and its purposes, legitimate interest, special feature, and special purpose settings.

MAUI

Display Banner

📘

Before you attempt to display a banner, ensure that the Show Banner setting on your geolocation rule is set to true. If it is set to false, the banner will never show.

Additionally, the shouldShowBanner SDK logic will decide to show or hide a banner. Please review the shouldShowBanner logic.

To display a banner built with OneTrust UI, follow the next steps:

  1. Configure an event handler for the OTUI_DataIsReady UI event.
  2. Within that event handler, add a checkmark to the shouldShowBanner checkbox.
  3. If shouldShowBanner: true, call the MainPageViewModel.LoadBanner() method.
// For MAUI, you control when and where the Banner is shown.
// Thus it is important to do this after the OTUI_DataIsReady event fires.
private async void OneTrustContentViewer_OTUI_DataIsReady(object sender, EventArgs e)
        {
            // ONCE THE SDK STARTS, THIS EVENT FIRES.
            System.Diagnostics.Debug.WriteLine("!!! OT SDK READY !!! ");
            // show the demo app user interface
            OTSDKDidLoad = true;
            // if we are supposed to show the banner, then load it.
            if (OTSDKHelper.ShowBanner)
            {
                await LoadBanner();
            }
            // print the log file
            printLog();
        } 

Display Preference Center

📘

Before you attempt to display a Preference Center, you need to decide how/where in the application you plan to expose a button/link that will trigger it to be shown. This is the most common use case across OneTrust.

To display a Preference Center built with OneTrust UI, follow the next steps:

  1. Configure your button click event handler or command.
  2. Call MainPageViewModel.LoadPreferenceCenter()
// Event Handler for Example Button
public ICommand ShowPreferenceCenter { get => new Command(async () => await ShowPreferenceCenterTask()); }
        private async Task ShowPreferenceCenterTask()
        {
            if (string.Equals(Preferences.Get("SDK_Loaded", "false"), "false"))
            {
                await ShowMessageAsync("SDK not loaded", "Warning", "Ok");
                return;
            }
            await LoadPreferenceCenter();
        }

.Net Native iOS and .Net Native Android

Display Banner

For both .Net Native iOS and .Net Native Android, the banner loads automatically based on SDK logic. The application can manually show the banner using this method:

OTSDK.sharedInstance.loadBanner();
OTSDK.sharedInstance.loadBanner();

Display Preference Center

OTSDK.sharedInstance.loadPreferenceCenter();
OTSDK.sharedInstance.loadPreferenceCenter();