Open flashman2 opened 4 years ago
I ended up with modifications in native code using these unpublished commits: iOS: https://github.com/sbugert/react-native-admob/pull/166/commits/6c5baa25a6dc410c5497e373c3978da46c99d2af Android: https://github.com/sbugert/react-native-admob/pull/469/commits/f0d7deb4e1733b011dd156b52b815095d7fc799c
Thanks @chsjr1996 and @koenpunt !
I hope maintainers of this module will use their solutions to add Targeting to this library.
Solution to target Ads for children (tagForChildDirectedTreatment):
iOS
Edit these files: RNAdMobInterstitial.m RNAdMobRewarded.m RNDFPBannerView.m RNGADBannerView.m
Find this:
GADRequest *request = [GADRequest request];
request.testDevices = _testDevices;
Add below this:
[GADMobileAds.sharedInstance.requestConfiguration tagForChildDirectedTreatment:YES];
Android
Edit these files: RNAdMobBannerViewManager.java RNAdMobInterstitialAdModule.java RNAdMobRewardedVideoAdModule.java RNPublisherBannerViewManager.java
Find line containing this:
... adRequest = adRequestBuilder.build();
Above this line, add this:
adRequestBuilder.tagForChildDirectedTreatment(true);
amazing @flashman2 ! Would you be able to submit a PR including these changes?
@flashman2 Did you create a working instance of this module? We're having a lot of trouble with Ad Targeting right now in our project. We're showing Ad Manager ads using this module (I guess it works because of the same SDK - Google Mobile Ads), but I couldn't find anywhere a working solution for Ad Targeting.
@dule9999 no, I just used mentioned solution to fix targeting issues in this module. It looks like author and maintainer is not interested in development of this module and PRs is not added. It need much more attention from maintainer.
https://rnfirebase.io/admob/usage - nowadays I would use this module for Ads. But it quite 'heavy' and much more complex in installation and usage than this one. So I hope someone will create new module based on this one.
@flashman2 Yeah, we tried using that one, but we need something more suitable for Ad Manager(custom ad campaigns), and this sits better with AdMob(random google ad campaigns). Either way, thanks for your reply.
Google Play rejected recent version of our app because Ads is not children directed. As per Google Admob recommendations: Call setTagForChildDirectedTreatment with TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE to indicate that you want your content treated as child-directed for purposes of COPPA. https://developers.google.com/admob/android/targeting https://developers.google.com/admob/ios/targeting
And also there is native code examples like this: RequestConfiguration requestConfiguration = MobileAds.getRequestConfiguration().toBuilder() .setTagForChildDirectedTreatment(TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE) .build();
But when I looked at the react-native-admob implementation, I didn't found requestConfiguration for Android and iOS where I could add setTagForChildDirectedTreatment
I guess, implementation of this module is a bit outdated, correct? Is there any way to implement this in react-native-admob? I'd be happy to submit a PR if someone can point me to right direction OR can help me with this.
For example, another Admob module Firebase/Admob already have Ad Targeting. But I like this module because it is lightweight compared to Firebase solution.