React Native

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.

ConstructorDescription
new TrustArcSdk()Creates a new TrustArc instance.

Initialization Methods

MethodsDescriptionParametersReturn
initialize

Initializes the TrustArc SDK


 

sdkMode: SdkMode, default: StandardPromise<void>
start

Starts the TrustArc SDK


 

domainName: String

country: String (Optional)

language: String (Optional)

state: String (Optional)

Promise<void>

Consent Management Methods

MethodsDescriptionParametersReturn
openCMManually opens the consent windowNonePromise
isSdkInitializedValidates if SDK setup is finished.NonePromise
useGdprDetectionOverrides consent behavior to "expressed".enable: booleanPromise
setUnifiedConsentContextSets unified consent context key. Domain is resolved from start(...).key: stringPromise
setUnifiedConsentIdentitySets unified consent identity using user id and HMAC.userId: string, hmac: stringPromise
enableAppTrackingTransparencyPromptEnables/disables ATT prompt (iOS only; no-op on Android).enabled: booleanPromise
getStoredConsentDataGets vendor consent data from local storage.NonePromise
getConsentDataByCategoryGets consent data grouped by category.NonePromise
getCategoryConsentGets consent for a specific category index.categoryIndex: numberPromise<string | null>
isCategoryConsentedChecks if a specific category index is consented.categoryIndex: numberPromise
getWebScriptRetrieves web script for web integration.NonePromise
isConsentPresentChecks if consent is present.NonePromise
getConsentValueRetrieves consent value for a specific tracker.trackerId: stringPromise
getTrustArcDeviceUUIDRetrieves the user consent identifier.NonePromise
getLastConsentGets timestamp of last consent update.NonePromise
getConsentLanguageRetrieves language code used during SDK initialization.NonePromise
getGoogleConsentsRetrieves Google Consent Mode data.NonePromise
getBehaviorRetrieves consent behavior setting.NonePromise
getSharedPreferencesRetrieves all stored shared preference values.NonePromise
getIABTCFPreferencesRetrieves IAB TCF preference values.NonePromise
getTcfStringRetrieves TCF string ((DEPRECATED); use getSharedPreferences().IABTCF_TCString).NonePromise
getTrackingAuthorizationStatusGets ATT authorization status (iOS only; Android returns notApplicable).NonePromise
isConsentExpiredChecks if stored consent has expired.NonePromise
getConsentExpiryDateGets stored consent expiry ((DEPRECATED); use getStoredConsentExpiry).NonePromise<number | null>
getStoredConsentExpiryGets stored consent expiry timestamp in milliseconds.NonePromise<number | null>

Information Retrieval Methods

MethodsDescriptionParametersReturn
getStoredConsentData

Gets the list of VendorConsent from local storage


 

NonePromise<Array<VendorConsent>>
getWebScriptRetrieves the web script for web integrationNonePromise<String>
isConsentPresentChecks if consent is presentNonePromise<Boolean>
getConsentValueRetrieves consent value for a specific trackertrackerId: StringPromise<String>
getTrustArcDeviceUUIDRetrieves the user’s consent identifierNonePromise<String>
getLastConsentGets the timestamp of last consent dataNonePromise<Number>
getConsentLanguageRetrieves the language code used during SDK initializationNonePromise<String>
getTcfStringRetrieves the TCF string (IAB mode only)NonePromise<String>
getGoogleConsentsRetrieves Google Consent Mode dataNonePromise<Object>
getBehaviorRetrieves the consent behavior settingNonePromise<String>
useGdprDetectionOverrides consent behavior to “expressed”, allowing consent modal to always show upon SDK initializationuseGdprDetection: booleanPromise<void>
getConsentDataByCategoryRetrieves the stored consent data grouped by categoryNonePromise<String>

Debug and Testing Methods

MethodsDescriptionParametersReturn
enableDebugLogEnables/disables native SDK debug logs.enabled: booleanPromise
generateHmacAuthIdTesting-only helper to generate HMAC auth id for unified consent workflows.userId: string, key: stringPromise<string | null>

VendorConsent Object

PropertyTypeDescription
domainStringThe domain identifier for the vendor
consentStringThe consent value ("1" for granted, "0" for denied)

SdkMode Enum

PropertyTypeDescription
standardStringStandard consent collection mode
iabTCFv_2_2StringIAB TCF compliant layout mode

IABTCFPreferences

Type definition for IAB TCF (Transparency & Consent Framework) preferences.

FieldDescription
IABTCF_PurposeOneTreatmentIndicates if Purpose One has special treatment (0 = no, 1 = yes)
IABTCF_VendorConsentsEncoded 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_PublisherCCPublisher's country code (e.g., "DE", "FR")
IABTCF_PublisherConsentEncoded string representing publisher-specific consent
IABTCF_gdprAppliesIndicates if GDPR applies (0 = no, 1 = yes)
IABTCF_SpecialFeaturesOptInsEncoded string representing special feature opt-ins
IABTCF_VendorLegitimateInterestsEncoded string representing vendor legitimate interests
IABTCF_PublisherLegitimateInterestsEncoded string representing publisher legitimate interests
IABTCF_PublisherCustomPurposesConsentsEncoded string representing publisher custom purposes consents
IABTCF_TCStringTC string containing the encoded user consent data
IABTCF_UseNonStandardTextsIndicates if non-standard text versions are used (0 = no, 1 = yes)
IABTCF_PolicyVersionIAB TCF policy version number
IABTCF_PurposeConsentsEncoded string representing purpose consents
IABTCF_PurposeLegitimateInterestsEncoded string representing purpose legitimate interests
IABTCF_CmpSdkIDCMP SDK ID
IABTCF_CmpSdkVersionCMP SDK version
IABTCF_PublisherCustomPurposesLegitimateInterestsEncoded string representing publisher custom purposes legitimate interests