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
View | Description |
---|---|
Banner | Notice to the user of their privacy rights. 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 Center | An interface for the user to view their current profile settings and update their choices based on the configuration provided for them. 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 Save Settings - this is required for a User to update their choices. |
Purpose Details | Sub-view of Preference Center. Displays more details about the purpose. Will display child purposes if configured. Will display links to Vendor List and SDK List if configured. |
SDK List | An 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 hidden in Template Settings in the Admin Console |
Vendor List | An interface, shown only for IAB2 type templates, displays a list of both IAB and Google Vendors in scope of the application. This provides a way for users to opt in/out of consent for a particular vendor. |
Vendor Details | A child interface of Vendor List, this view shows more granular information about a vendor and its Purpose, Legitimate Interest, Special Feature, and Special Purpose settings. |
Xamarin Forms
Display Banner
Note: Before you attempt to display a Banner, you need to first make sure the
Show Banner
setting on your Geolocation Rule is set totrue
. If it's set tofalse
, a Banner will never show.Additionally, the SDK has
shouldShowBanner
logic where it will make a decision to show/hide a banner. Please review theshouldShowBanner
logic.
To display a Banner built with OneTrust UI, you'll need to:
- Configure an event handler for
OTUI_DataIsReady
UI event. - Within that event handler, include the
shouldShowBanner
check - If
shouldShowBanner: true
, call theOneTrustContentViewer.LoadBanner()
method.
Example:
// For Xamarin Forms, 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 COMPLETES INIT, THIS EVENT FIRES.
System.Diagnostics.Debug.WriteLine("!!! OT SDK READY !!! ");
// if we are supposed to show the banner, then load it.
if (CMPSDK.sharedInstance.shouldShowBanner) {
OneTrustContentViewer.LoadBanner();
}
await Task.CompletedTask;
}
Display Preference Center
Note: 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 clients.
To display a Preference Center built with OneTrust UI, you'll need to:
- Configure your button click event handler or command
- Call
OneTrustContentViewer.LoadPreferenceCenter()
Example:
// Event Handler for Example Button
public ICommand ShowPreferenceCenter { get => new Command(async () => await ShowPreferenceCenterTask()); }
private async Task ShowPreferenceCenterTask()
{
// Load OneTrust Preference Center
OneTrustContentViewer.LoadPreferenceCenter();
await Task.CompletedTask;
}
<!-- Example Application Button -->
<Button
Margin="0,10,0,0"
Text="TEST PREF CENTER"
Command="{Binding ShowPreferenceCenter}"
BackgroundColor="Green"
TextColor="White"
></Button>
Xamarin.iOS and Xamarin.Android
Display Banner
For both Xamarin.iOS
and Xamarin.Android
, the Banner loads automatically based on SDK logic. That said, application can manually show the Banner using this method:
OTSDK.sharedInstance.loadBanner();
OTSDK.sharedInstance.loadBanner();
Display Preference Center
OTSDK.sharedInstance.loadPreferenceCenter();
OTSDK.sharedInstance.loadPreferenceCenter();
Updated 9 months ago