react-native-google-mobile-ads age limitation

334 views Asked by At

I've built an app using react-native and i'm using: react-native-google-mobile-ads and im trying to show ads that are only familey friendly. how can i do this in react native?

import { View } from "react-native";
import {
  BannerAd,
  BannerAdSize,
  TestIds,
} from "react-native-google-mobile-ads";

const adUnitId = __DEV__
  ? TestIds.BANNER
  : "ca-app-pub-8453281779869033/5007999033";

export default function BottomBanner() {
  return (
    <View style={{ justifyContent: "center", alignItems: "center" }}>
      <BannerAd
        style={{ width: "100%", height: 100 }}
        unitId={adUnitId}
        size={BannerAdSize.FULL_BANNER}
        requestOptions={{
          requestNonPersonalizedAdsOnly: true,
        }}
      />
    </View>
  );
}

tried searching the docs

1

There are 1 answers

2
gulliver On
  1. import {MaxAdContentRating,} from "react-native-google-mobile-ads";
    
  2. Add this to your requestOptions:

    maxAdContentRating: MaxAdContentRating.PG,
    tagForChildDirectedTreatment: true,
    tagForUnderAgeOfConsent: true