Optionaloptions: AdsConsentInfoOptions
An AdsConsentInfoOptions interface.
Returns the UMP Consent Information from the last known session.
import { AdsConsent } from '@invertase/react-native-google-ads';
const consentInfo = await AdsConsent.getConsentInfo();
Returns the value stored under the IABTCF_gdprApplies key
in NSUserDefaults (iOS) / SharedPreferences (Android) as
defined by the IAB Europe Transparency & Consent Framework.
More information available here: https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB Tech Lab - CMP API v2.md#in-app-details
import { AdsConsent } from '@invertase/react-native-google-ads';
await AdsConsent.requestInfoUpdate();
const gdprApplies = await AdsConsent.getGdprApplies();
Returns the value stored under the IABTCF_PurposeConsents key
in NSUserDefaults (iOS) / SharedPreferences (Android) as
defined by the IAB Europe Transparency & Consent Framework.
More information available here: https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB Tech Lab - CMP API v2.md#in-app-details
import { AdsConsent } from '@invertase/react-native-google-ads';
await AdsConsent.requestInfoUpdate();
const purposeConsents = await AdsConsent.getPurposeConsents();
const hasConsentForPurposeOne = purposeConsents.startsWith("1");
Returns the value stored under the IABTCF_PurposeLegitimateInterests key
in NSUserDefaults (iOS) / SharedPreferences (Android) as
defined by the IAB Europe Transparency & Consent Framework.
More information available here: https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB Tech Lab - CMP API v2.md#in-app-details
import { AdsConsent } from '@invertase/react-native-google-ads';
await AdsConsent.requestInfoUpdate();
const purposeLegitimateInterests = await AdsConsent.getPurposeLegitimateInterests();
const hasLegitimateInterestForPurposeTwo = purposeLegitimateInterests.split("")[1] === "1";
Returns the value stored under the IABTCF_TCString key
in NSUserDefaults (iOS) / SharedPreferences (Android) as
defined by the IAB Europe Transparency & Consent Framework.
More information available here: https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB Tech Lab - CMP API v2.md#in-app-details
import { AdsConsent } from '@invertase/react-native-google-ads';
const tcString = await AdsConsent.getTCString();
Provides information about a user's consent choices.
import { AdsConsent } from '@invertase/react-native-google-ads';
const { storeAndAccessInformationOnDevice } = await AdsConsent.getUserChoices();
Loads a consent form and immediately presents it if consentStatus is required.
This method is intended for the use case of showing a form if needed when the app starts.
Requests user consent information.
The response from this method provides information about consent form availability and consent status.
import { AdsConsent } from 'react-native-google-mobile-ads';
const consentInfo = await AdsConsent.requestInfoUpdate();
console.log('A consent form is available:', consentInfo.isConsentFormAvailable);
console.log('User consent status:', consentInfo.status);
Optionaloptions: AdsConsentInfoOptions
An AdsConsentInfoOptions interface.
Shows a Google-rendered user consent form.
import { AdsConsent, AdsConsentStatus } from 'react-native-google-mobile-ads';
async function requestConsent() {
const consentInfo = await AdsConsent.requestInfoUpdate();
// Check if user requires consent
if (
consentInfo.isConsentFormAvailable &&
(consentInfo.status === AdsConsentStatus.UNKNOWN ||
consentInfo.status === AdsConsentStatus.REQUIRED)) {
// Show a Google-rendered form
const formResult = await AdsConsent.showForm();
console.log('User consent obtained: ', formResult.status === AdsConsentStatus.OBTAINED);
}
}
Presents a privacy options form if privacyOptionsRequirementStatus is required.
Helper method to call the UMP SDK methods to request consent information and load/present a consent form if necessary.