Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TargetingInfo] Added targeting info to the newest version (WeTransfer link + File in the post) #162

Open
Nikolak47 opened this issue May 12, 2020 · 24 comments

Comments

@Nikolak47
Copy link

Hey!
I just added targetingInfo (from the guy who failed to merge) to the newest state of the package.
Too lazy to make a pull request, so I'll just upload the zip file, for someone to do it.
Package (WeTransfer link):
https://we.tl/t-SfTm7GqAmu

If you find any problems/bugs, message me.
Will be glad if this is added to the newest version.
As file:
admob_flutter-withTargetingInfo.zip

@Nikolak47 Nikolak47 changed the title [TargetingInfo] Added targeting info to the newest version [TargetingInfo] Added targeting info to the newest version (WeTransfer link + File in the post) May 12, 2020
@yiss
Copy link

yiss commented May 14, 2020

I can make the pull request and implement it.
Edit : also thinking maybe update the plugin to support the new plugin API used by Flutter >= 1.12

@Nikolak47
Copy link
Author

@yiss Yes, do it please :)
Also, can you tell me if it shows you ads on your physical device ?

@kmcgill88
Copy link
Owner

Whats up @yiss and @Nikolak47

I'm sorry I've been busy with my day job. If you have a solid solution for targeting please PR it. I'll be getting back to this project soon. I'm also going to need web support!

@yiss
Copy link

yiss commented May 15, 2020

Hi @kmcgill88 we totally understand no worries. I'm happy to help

@davidmartos96
Copy link

I would love to see this feature implemented. I'm currently using a fork which adds an optional parameter "personalizedAds" to comply with the GDPR.

@yiss
Copy link

yiss commented May 15, 2020

@davidmartos96 can you link this fork please so that I can take a look at it ?

@davidmartos96
Copy link

@yiss Sure, it's https://github.com/js2702/admob_flutter and the branch non_personalized.

@yiss
Copy link

yiss commented May 15, 2020

Here is the pull request #164 I added the same AdRequestFactoryBuilder used by the official Flutter admob plugin the modifications work fine I tested it on my mobile device : https://drive.google.com/file/d/1eNftPAGkBXPnX8vRRs1lReMTYj83Vqt-/view

@Nikolak47
Copy link
Author

@yiss Can you tell me how to use it ?
Here is my implementation, step by step:

  1. I declare MobileAdTargetingInfo kTargetingInfo = MobileAdTargetingInfo(...) *put my deviceID in 'testDevices' and 'keywords'
  2. I declare AdMobBanner and put the kTargetingInfo as parameter *tried also with Test Banner Id
  3. I launch the application to my mobile device and the ads are not showing

@yiss
Copy link

yiss commented May 15, 2020

@Nikolak47 I use

MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
  keywords: <String>['flutterio', 'beautiful apps'],
  contentUrl: 'https://flutter.io',
  birthday: DateTime.now(),
  childDirected: false,
  designedForFamilies: false,
  gender:
      MobileAdGender.male, // or MobileAdGender.female, MobileAdGender.unknown
  testDevices: <String>[
    // Add the String showed in this line in the console < Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("AAAAAAAAAAAAAAAAAAAAAAAA") to get test ads on this device. >
    // To load ads on test devices
    //'AAAAAAAAAAAAAAAAAAAAAAAA'
  ], // Android emulators are considered test devices
);

And then I use it

interstitialAd = AdmobInterstitial(
      adUnitId: getInterstitialAdUnitId(),
      targetingInfo: targetingInfo,
      listener: (AdmobAdEvent event, Map<String, dynamic> args) {
        if (event == AdmobAdEvent.closed) interstitialAd.load();
        handleEvent(event, args, 'Interstitial');
      },
    );

    rewardAd = AdmobReward(
        adUnitId: getRewardBasedVideoAdUnitId(),
        targetingInfo: targetingInfo,
        listener: (AdmobAdEvent event, Map<String, dynamic> args) {
          if (event == AdmobAdEvent.closed) rewardAd.load();
          handleEvent(event, args, 'Reward');
        });

And for the Banner :

dmobBanner(
                      targetingInfo: targetingInfo,
                      adUnitId: getBannerAdUnitId(),
                      adSize: bannerSize,
                      listener:
                          (AdmobAdEvent event, Map<String, dynamic> args) {
                        handleEvent(event, args, 'Banner');
                      },
                    ),

I forgot to update the main.dart in example I just did :) cheers

@yiss
Copy link

yiss commented May 15, 2020

Normally if it's working properly it should print I/Ads (30315): This request is sent from a test device. in the console

@yiss
Copy link

yiss commented May 15, 2020

@Nikolak47 let me know if that worked for you

@Nikolak47
Copy link
Author

@yiss Thanks for the example.
It works with banners, but I still can't make it work with interstitial ads...

@yiss
Copy link

yiss commented May 15, 2020

@Nikolak47 are you using your version or mine? Because in yours you haven't implemented targetingInfo for interstitial. I did it for the interstitial and reward ad you can check it on my github : https://github.com/yiss/admob_flutter the last commit is what you need. Waiting for the PR to be merged

@Nikolak47
Copy link
Author

I'm using your version...
image

@yiss
Copy link

yiss commented May 15, 2020

@Nikolak47 weird, can you show me the console output? Does it say anything?

@Nikolak47
Copy link
Author

I think the problem with not showing interstitial Ads on the test device is 'Error: 3' (selected in red), because earlier when I was trying to load interstitial ad, it threw this error.
Also, after implementing this package, I started getting the getStreamVolume isRestricted mode = 0 (selected in blue).
image

@yiss
Copy link

yiss commented May 15, 2020

@Nikolak47 Erro 3 means that the request was successful but there is no Ad to serve this can be caused by many reasons. Can you test your interstitial with the one here : https://developers.google.com/admob/android/test-ads

@Nikolak47
Copy link
Author

@yiss Thank you very much, it works!
There is probably a problem with the interstitial Ad I defined in my admob account.
Thanks again! :)

@yiss
Copy link

yiss commented May 15, 2020

Alright! That's good news to hear. Glad I can help

@cyberlahy
Copy link

Hi,
does this include the non-personalized? and which package and branch do I need or waiting the PR here?
thanks

@yiss
Copy link

yiss commented May 19, 2020

@cyberlahy yes by default it's non personalised, I made a PR waiting for it to be merged. You can check out my fork it contains the proper working version

@cyberlahy
Copy link

@yiss I see your code and I think it's by default "personalized" and we need to precise if it is not. Or I am wrong?

@yiss
Copy link

yiss commented May 20, 2020

@cyberlahy by the default targetingInfo is not required, when specify targetingInfo property you're then doing a personalized ads, example :
If you do targetingInfo: MobileAdTargetingInfo() without specifying any targeting info it's not personalized, if you add something like gender, date... Then it becomes personalized ads. You can check here :https://support.google.com/admob/answer/7676680?hl=en

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants