ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
499 stars 214 forks source link

Consent for personalizated ads #210

Open angelbuzon opened 6 years ago

angelbuzon commented 6 years ago

Hi, is there any option to the GDPR:

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

MBuchalik commented 6 years ago

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 ... ?

ivanov84 commented 6 years ago

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

DevelopedByAnurag commented 6 years ago

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.

ivanov84 commented 6 years ago

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

distante commented 6 years ago

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.

lpopova commented 6 years ago

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?

gartorware commented 5 years ago

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.

tominou commented 5 years ago

@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);
crushingCodes commented 5 years ago

@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}
ivanov84 commented 5 years ago

@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 commented 5 years ago

@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

crushingCodes commented 5 years ago

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

hooliapps commented 5 years ago

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 ?

gartorware commented 5 years ago

@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.

hooliapps commented 5 years ago

Thanks for response.

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

gartorware commented 5 years ago

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).

X0t0 commented 5 years ago

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

crushingCodes commented 5 years ago

@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

X0t0 commented 5 years ago

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

wo-github commented 5 years ago

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

distante commented 5 years ago

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?

prantikv commented 5 years ago

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

alexp25 commented 3 years ago

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.

brunoalex commented 3 years ago

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

distante commented 3 years ago

Just send npa: 1

brunoalex commented 3 years ago
     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

distante commented 3 years ago
     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

alexp25 commented 3 years ago

@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?

brunoalex commented 3 years ago

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

brunoalex commented 3 years ago

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 ...

distante commented 3 years ago

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

I just manage my self the consent and send or not the npa extra option. If you see the Java code, the extra options are correctly sended.