cordova-plugin-admob-free icon indicating copy to clipboard operation
cordova-plugin-admob-free copied to clipboard

Consent for personalizated ads

Open angelbuzon opened this issue 7 years ago • 31 comments

Hi, is there any option to the GDPR:

https://developers.google.com/admob/android/eu-consent#forward_consent_without_the_consent_sdk

angelbuzon avatar May 03 '18 19:05 angelbuzon

Hm what I don't understand is: What will happen if we don't show the dialog? Is this considered "breaking the law", will Google stop serving ads, or ... ?

MBuchalik avatar May 05 '18 10:05 MBuchalik

Or millions to pay... But what if I don't have them? 😲

ivanov84 avatar May 05 '18 13:05 ivanov84

hey Google will show adds to us but if app is used by european people you might get penalised by europe government that is 4% of global revenue or app will get banned in europe and continue to work worldwide.This is for european users only.

DevelopedByAnurag avatar May 06 '18 14:05 DevelopedByAnurag

@anuragbatra but european people can be out of europe so app can violate law...

ivanov84 avatar May 09 '18 05:05 ivanov84

For now I just have a global user agreement that wraps Ads and Analytics. If the user does not consent it then he can not use it.

distante avatar May 11 '18 07:05 distante

Is there any communication between the plugin and Admob if you don't call prepare and show? Are you safe if you add the plugin to the apk but for users that don't want tracking to not show and prepare ads?

lpopova avatar May 13 '18 15:05 lpopova

At least we need this part to be configurable

Bundle extras = new Bundle();
extras.putString("npa", "1");

AdRequest request = new AdRequest.Builder()
        .addNetworkExtrasBundle(AdMobAdapter.class, extras)
        .build();

So we can build our own consent sdk and show non targeted ads if needed.

gartorware avatar May 22 '18 20:05 gartorware

@gartorware I think it is already doable by adding this when you create a banner/interstitial: adExtras: {npa: 1}

For example:

admob.banner.config({
    id: 'bannerId',
    autoShow: false,
    overlap: true,
    adExtras: {npa: 1}
});
admob.banner.prepare();

See the actual code of the plugin:

AdmobConfig.java

if (options.has(OPT_AD_EXTRAS)) {
        this.adExtras = options.optJSONObject(OPT_AD_EXTRAS);
}

Admob.java

        Bundle bundle = new Bundle();
        bundle.putInt("cordova", 1);
        if (config.adExtras != null) {
            Iterator<String> it = config.adExtras.keys();
            while (it.hasNext()) {
                String key = it.next();
                try {
                    bundle.putString(key, config.adExtras.get(key).toString());
                } catch (JSONException exception) {
                    Log.w(TAG, String.format("Caught JSON Exception: %s", exception.getMessage()));
                }
            }
        }
        builder = builder.addNetworkExtrasBundle(AdMobAdapter.class, bundle);

tominou avatar May 23 '18 05:05 tominou

@tominou Thankyou for the suggestion, however it didn't work. I tried many combinations but cant figure it out.

Here is the error:

[22:50:46]  typescript: src/app/app.component.ts, line: 69 
            Type '{ id: string; autoShow: false; isTesting: false; size: string; adExtras: { npa: number; }; }' is not 
            assignable to type 'AdMobFreeBannerConfig'. Object literal may only specify known properties, and 'adExtras' 
            does not exist in type 'AdMobFreeBannerConfig'. 

      L69:              adExtras: {npa: 1}

crushingCodes avatar May 23 '18 13:05 crushingCodes

@crushingCodes I just added to some logic and modified AdMob.java and AdMobConfig and it works =)

I sent new type of size and execute it with new param if user set npa

ivanov84 avatar May 23 '18 14:05 ivanov84

@crushingCodes We have 1 day. I modified files and it works 😄

just use BANNER_GDPR and SMART_BANNER_GDPR as AdSiz if you need to set npa option:

let options: AdMobFreeBannerConfig = {
  id: this.user.admobid.banner,
  isTesting: false,
  autoShow: true
};

options.size = (this.user.currentLanguage == "ru" ? "BANNER" : "SMART_BANNER") + (this.user.gdprRestrictionEnabled ? "_GDPR" : "");

src.zip

ivanov84 avatar May 23 '18 17:05 ivanov84

@ivanov84 Thank you so much. I will have a go as soon as I get a chance this afternoon

crushingCodes avatar May 23 '18 22:05 crushingCodes

Hello,

Do you know if this very nice plugin will be updated to allow setting the npa flag ?

Google consent sdk already exists as cordova plugin ?

hooliapps avatar May 23 '18 22:05 hooliapps

@tominou Thanks for the tip, I'm going to check that, seems like the way to go. @crushingCodes That's not a problem with this plugin, but with ionic-native wrapper. Just add this while they update the code:

export interface ExtendedAdMobFreeBannerConfig extends AdMobFreeBannerConfig {
  adExtras: any;
}
export interface ExtendedAdMobFreeInterstitialConfig extends AdMobFreeInterstitialConfig {
  adExtras: any;
}
export interface ExtendedAdMobFreeRewardVideoConfig extends AdMobFreeRewardVideoConfig {
  adExtras: any;
}

And then use your custom interface instead of theirs:

   const bannerImageConfig: ExtendedAdMobFreeBannerConfig = {
      id: ....,
      isTesting: true,
      autoShow: true,
      bannerAtTop: false,
      overlap: false,
      offsetTopBar: true,
      adExtras: { npa: 1 }
   };
   this.admobFree.banner.config(bannerImageConfig);
   this.admobFree.banner.prepare();

I'm going to check if it works.

gartorware avatar May 24 '18 15:05 gartorware

Thanks for response.

But we cannot do that with phonegap build ? (We cannot edit plugin codes)

hooliapps avatar May 24 '18 20:05 hooliapps

That change is not in plugin code, it can be done in your code. Just add the new interfaces before your app.component class (or wherever you use the plugin).

Anyway I cannot try if it works because firebase (I guess) has been updated and now I can't build my project (no time to create a new one sorry).

gartorware avatar May 25 '18 09:05 gartorware

Guys i need to add this to my apps is it automatically show notification to agree or i need to add it manually

X0t0 avatar May 27 '18 03:05 X0t0

@gartorware Hey mate, that did the trick, well at least its building and letting me use the npa setting so should be good now, next step will be trying to work out this consent business. Your advice is nice and easy to implement cheers

crushingCodes avatar May 27 '18 14:05 crushingCodes

@crushingCodes bro can you help me to add this to my app to comply with the new GDPR update

X0t0 avatar May 28 '18 02:05 X0t0

@gartorware how can I check if I setting this option, it leads to no personalised advertising being delivered in my app?

wo-github avatar May 28 '18 05:05 wo-github

Is there a way to see a list of what can we use for in this OPT_AD_EXTRAS??

also: +1 to how can I check if I setting this option, it leads to no personalized advertising being delivered in my app?

distante avatar Jun 01 '18 17:06 distante

did you find out how to check if ads are personalized or not @gartorware @wo-github

prantikv avatar Jun 15 '18 03:06 prantikv

It is theoretically a very critical issue so it needs to be properly tested and documented ASAP as you can get fined at least 20 million for infringements. Maybe even make this the default option (with npa flag set) to prevent developer mistakes.

alexp25 avatar Aug 26 '20 08:08 alexp25

yes , if some one can help me with this would be great... playstore and admob is sending alerts to use this or apps will get banned

brunoalex avatar Aug 26 '20 10:08 brunoalex

Just send npa: 1

distante avatar Aug 26 '20 11:08 distante

     admob.interstitial.config({
 id: 'ca-app-pub-xx',isTesting: false,adExtras: { npa: 1 }
})   or      admob.interstitial.config({
 id: 'ca-app-pub-xxx',isTesting: false
}). 

is sending the same ads ... i realy dont think this adExtras: { npa: 1 } is working @ratson

brunoalex avatar Aug 27 '20 13:08 brunoalex

     admob.interstitial.config({
 id: 'ca-app-pub-xx',isTesting: false,adExtras: { npa: 1 }
})   or      admob.interstitial.config({
 id: 'ca-app-pub-xxx',isTesting: false
}). 

is sending the same ads ... i realy dont think this adExtras: { npa: 1 } is working @ratson

AFAIK @ratson does not works in this repo anymore but on https://github.com/admob-plus/admob-plus

distante avatar Aug 27 '20 13:08 distante

@brunoalex how can you tell if the npa flag is actually being sent? maybe those are the ads that are served for non-personalized option too. I mean, are you sure that it's not sending the flag to the admob sdk?

alexp25 avatar Aug 27 '20 13:08 alexp25

oh ok @distante did you manage to get this working ?

brunoalex avatar Aug 27 '20 14:08 brunoalex

thats just it .. i dont know ... the ads look the same.. i tried to check the url from the ads to see if they have &npa but they didnt ...

brunoalex avatar Aug 27 '20 14:08 brunoalex