[Unity] 2. API Documentation
Initialize
Initializes the Consent Manager with the provided domain, code ID, app name, and language.
Parameters
Name | Type | Description |
domain | String | The domain of the Consent Management Platform. |
codeId | String | The code ID for the application. |
appName | String | The name of the application. |
language | String | The language code (e.g., "EN", "DE") for localization. |
Example
Initialize(domain = ..., codeId = ..., appName = ..., language = ...)
SetAndroidCallbacks
Sets Android-specific callbacks for CMP events.
HasConsent
Checks if the user has given consent.
Return
true if user has given consent, false otherwise.
Example
HasConsent()
OpenConsentLayer
Opens the Consent Layer to manage user's consent settings.
Example
OpenConsentLayer()
OpenConsentLayerOnCheck
Opens the Consent Layer if necessary based on checks.
Example
OpenConsentLayerOnCheck()
HasVendor
Checks if a vendor with the specified ID has been selected by the user.
Parameters
- id: The ID of the vendor to check.
Return Type
bool: True if the vendor is selected, false otherwise.
Example
bool result = HasVendor("vendorId");
HasPurpose
Checks if a purpose with the specified ID has been selected by the user.
Parameters
- id: The ID of the purpose to check.
Return Type
bool: True if the purpose is selected, false otherwise.
Example
bool result = HasPurpose("purposeId");
GetAllPurposes
Gets a list of all available purposes.
Return Type
List<string>: A list of purpose IDs.
Example
List<string> purposes = GetAllPurposes();
GetEnabledPurposes
Gets a list of enabled purposes.
Return Type
List<string>: A list of enabled purpose IDs.
Example
List<string> enabledPurposes = GetEnabledPurposes();
GetDisabledPurposes
Gets a list of disabled purposes.
Return Type
List<string>: A list of disabled purpose IDs.
Example
List<string> disabledPurposes = GetDisabledPurposes();
GetAllVendors
Gets a list of all available vendors.
Return Type
List<string>: A list of vendor IDs.
Example
List<string> allVendors = GetAllVendors();
GetEnabledVendors
Gets a list of enabled vendors.
Return Type
List<string>: A list of enabled vendor IDs.
Example
List<string> enabledVendors = GetEnabledVendors();
GetDisabledVendors
Gets a list of disabled vendors.
Return Type
List<string>: A list of disabled vendor IDs.
Example
List<string> disabledVendors = GetDisabledVendors();
ExportCmpString
Exports the Consent Management Platform (CMP) settings as a string.
Return Type
string: The exported CMP settings as a string.
Example
string cmpSettings = ExportCmpString();
GetGoogleAcString
Gets the Google Advertiser Consent string.
Return Type
string: The Google Advertiser Consent string.
Example
string googleAcString = GetGoogleAcString();
GetUsPrivacyString
Gets the US Privacy string.
Return Type
string: The US Privacy string.
Example
string usPrivacyString = GetUsPrivacyString();