The following documentation outlines the APIs available for use in the TrustArc Mobile Consent SDK for React Native projects.
TrustArc Class
The TrustArc class is the main entry point for interacting with the TrustArc SDK.
| Constructor | Description |
| new TrustArcSdk() | Creates a new TrustArc instance. |
Initialization Methods
| Methods | Description | Parameters | Return |
| initialize | Initializes the TrustArc SDK
| sdkMode: SdkMode, default: Standard | Promise<void> |
| start | Starts the TrustArc SDK
| domainName: String country: String (Optional) language: String (Optional) state: String (Optional) | Promise<void> |
Consent Management Methods
| Methods | Description | Parameters | Return |
| openCM | Manually opens the consent window | None | Promise |
| isSdkInitialized | Validates if SDK setup is finished. | None | Promise |
| useGdprDetection | Overrides consent behavior to "expressed". | enable: boolean | Promise |
| setUnifiedConsentContext | Sets unified consent context key. Domain is resolved from start(...). | key: string | Promise |
| setUnifiedConsentIdentity | Sets unified consent identity using user id and HMAC. | userId: string, hmac: string | Promise |
| enableAppTrackingTransparencyPrompt | Enables/disables ATT prompt (iOS only; no-op on Android). | enabled: boolean | Promise |
| getStoredConsentData | Gets vendor consent data from local storage. | None | Promise |
| getConsentDataByCategory | Gets consent data grouped by category. | None | Promise |
| getCategoryConsent | Gets consent for a specific category index. | categoryIndex: number | Promise<string | null> |
| isCategoryConsented | Checks if a specific category index is consented. | categoryIndex: number | Promise |
| getWebScript | Retrieves web script for web integration. | None | Promise |
| isConsentPresent | Checks if consent is present. | None | Promise |
| getConsentValue | Retrieves consent value for a specific tracker. | trackerId: string | Promise |
| getTrustArcDeviceUUID | Retrieves the user consent identifier. | None | Promise |
| getLastConsent | Gets timestamp of last consent update. | None | Promise |
| getConsentLanguage | Retrieves language code used during SDK initialization. | None | Promise |
| getGoogleConsents | Retrieves Google Consent Mode data. | None | Promise |
| getBehavior | Retrieves consent behavior setting. | None | Promise |
| getSharedPreferences | Retrieves all stored shared preference values. | None | Promise |
| getIABTCFPreferences | Retrieves IAB TCF preference values. | None | Promise |
| getTcfString | Retrieves TCF string ((DEPRECATED); use getSharedPreferences().IABTCF_TCString). | None | Promise |
| getTrackingAuthorizationStatus | Gets ATT authorization status (iOS only; Android returns notApplicable). | None | Promise |
| isConsentExpired | Checks if stored consent has expired. | None | Promise |
| getConsentExpiryDate | Gets stored consent expiry ((DEPRECATED); use getStoredConsentExpiry). | None | Promise<number | null> |
| getStoredConsentExpiry | Gets stored consent expiry timestamp in milliseconds. | None | Promise<number | null> |
Information Retrieval Methods
| Methods | Description | Parameters | Return |
| getStoredConsentData | Gets the list of VendorConsent from local storage
| None | Promise<Array<VendorConsent>> |
| getWebScript | Retrieves the web script for web integration | None | Promise<String> |
| isConsentPresent | Checks if consent is present | None | Promise<Boolean> |
| getConsentValue | Retrieves consent value for a specific tracker | trackerId: String | Promise<String> |
| getTrustArcDeviceUUID | Retrieves the user’s consent identifier | None | Promise<String> |
| getLastConsent | Gets the timestamp of last consent data | None | Promise<Number> |
| getConsentLanguage | Retrieves the language code used during SDK initialization | None | Promise<String> |
| getTcfString | Retrieves the TCF string (IAB mode only) | None | Promise<String> |
| getGoogleConsents | Retrieves Google Consent Mode data | None | Promise<Object> |
| getBehavior | Retrieves the consent behavior setting | None | Promise<String> |
| useGdprDetection | Overrides consent behavior to “expressed”, allowing consent modal to always show upon SDK initialization | useGdprDetection: boolean | Promise<void> |
| getConsentDataByCategory | Retrieves the stored consent data grouped by category | None | Promise<String> |
Debug and Testing Methods
| Methods | Description | Parameters | Return |
| enableDebugLog | Enables/disables native SDK debug logs. | enabled: boolean | Promise |
| generateHmacAuthId | Testing-only helper to generate HMAC auth id for unified consent workflows. | userId: string, key: string | Promise<string | null> |
VendorConsent Object
| Property | Type | Description |
| domain | String | The domain identifier for the vendor |
| consent | String | The consent value ("1" for granted, "0" for denied) |
SdkMode Enum
| Property | Type | Description |
| standard | String | Standard consent collection mode |
| iabTCFv_2_2 | String | IAB TCF compliant layout mode |
IABTCFPreferences
Type definition for IAB TCF (Transparency & Consent Framework) preferences.
| Field | Description |
| IABTCF_PurposeOneTreatment | Indicates if Purpose One has special treatment (0 = no, 1 = yes) |
| IABTCF_VendorConsents | Encoded string representing vendor consents |
| IABTCF_enableAdvertiserConsentMode | Whether advertiser consent mode is enabled
Google’s latest Firebase SDK release for iOS and Android now supports TCF. To ensure proper consent handling and compatibility with the SDK, please set IABTCF_enableAdvertiserConsentMode to 1 when using TCF so Google can infer consent from the TC string. |
| IABTCF_PublisherCC | Publisher's country code (e.g., "DE", "FR") |
| IABTCF_PublisherConsent | Encoded string representing publisher-specific consent |
| IABTCF_gdprApplies | Indicates if GDPR applies (0 = no, 1 = yes) |
| IABTCF_SpecialFeaturesOptIns | Encoded string representing special feature opt-ins |
| IABTCF_VendorLegitimateInterests | Encoded string representing vendor legitimate interests |
| IABTCF_PublisherLegitimateInterests | Encoded string representing publisher legitimate interests |
| IABTCF_PublisherCustomPurposesConsents | Encoded string representing publisher custom purposes consents |
| IABTCF_TCString | TC string containing the encoded user consent data |
| IABTCF_UseNonStandardTexts | Indicates if non-standard text versions are used (0 = no, 1 = yes) |
| IABTCF_PolicyVersion | IAB TCF policy version number |
| IABTCF_PurposeConsents | Encoded string representing purpose consents |
| IABTCF_PurposeLegitimateInterests | Encoded string representing purpose legitimate interests |
| IABTCF_CmpSdkID | CMP SDK ID |
| IABTCF_CmpSdkVersion | CMP SDK version |
| IABTCF_PublisherCustomPurposesLegitimateInterests | Encoded string representing publisher custom purposes legitimate interests |