react-native-google-mobile-ads icon indicating copy to clipboard operation
react-native-google-mobile-ads copied to clipboard

[🐛] [Android] Impressions tracking issue

Open MateuszPrasal opened this issue 2 years ago • 4 comments

Issue

Hi ! I've noticed issue connected with tracking ad impressions in Android. After showing ad on screen, I can't see request to Google which tells us that ad is being impressed, even onAdImpression callback isn't fired. Problem refers to banners, because in my app I'm using only GAM Banners (GAMBannerAd component). What I've noticed, issue can be connected with React Navigation package because when my GAMBannerAd is wrapped by Screen (from React Navigation package), then impression isn't fired (as below)

Screenshot from 2022-07-27 17-44-11

Same situation is when Ad component is wrapped by SafeAreaProvider (one of package from React Navigation) - i think generally that main problem is connected with SafeAreaView on Android

Screenshot from 2022-07-27 17-51-35

But if Ad component isn't wrapped by Screen component - everything works well, impression is being tracked correctly

Screenshot from 2022-07-27 17-48-37 Screenshot from 2022-07-27 17-47-18

I've also noticed that when Ad is being put inside FlatList and it will show after swipe list - then impression is being tracked correctly. What is important - on iOS there is no problem with it, every ad is being tracked properly.

To be honest, I have no idea what else I can do with it, I hope that anyone had similar problem and has solution :)

Thank You in advance !


Environment

Click To Expand

react-native info output:

System:
    OS: Linux 4.15 Ubuntu 18.04.5 LTS (Bionic Beaver)
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 17.57 GB / 31.29 GB
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.14.14 - ~/.nvm/versions/node/v14.17.5/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    Android SDK:
      API Levels: 28, 29, 30, 31, 32
      Build Tools: 23.0.1, 27.0.3, 28.0.2, 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 32.0.0
      System Images: android-24 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 11.0.8 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.65.1 => 0.65.1 
  npmGlobalPackages:
    *react-native*: Not Found
  • Platform that you're experiencing the issue on:
    • [ ] iOS
    • [x] Android
    • [ ] iOS but have not tested behavior on Android
    • [ ] Android but have not tested behavior on iOS
    • [ ] Both
  • Are you using TypeScript?
    • Y & 4.5.5

  • 👉 Check out Invertase on Twitter for updates on the library.

MateuszPrasal avatar Jul 28 '22 06:07 MateuszPrasal

A reproducible example would help - ideally a PR based on the example or a repo forked with changes to the example that add navigation and show the problem along with instructions on how to view it working vs not working ?

Then from there you could see what's going on perhaps. Might have to do with react-native-screens perhaps and use of fragments natively or similar but that is a seriously iffy guess, I have no actual knowledge of the same, just some vague recollection of how navigation maps to native things on android and your mention that ios is good but android is not made me think of it

mikehardy avatar Jul 30 '22 22:07 mikehardy

Hi @mikehardy ! Thank You for response :) Here it's PR with example described in this issue

https://github.com/invertase/react-native-google-mobile-ads/pull/200

I've added onAdImpression listener and as I've writeen above, after adding React Navigation package onAdImpression listeren isn't being triggered after launch app (when we'll remove componencts from React Navigation, listener is triggering correctly)

I'll be very grateful for help, because it's very big problem for me. Also I think that lot of users has same issue, but of course it depends on people use impressions counter :)

MateuszPrasal avatar Aug 01 '22 07:08 MateuszPrasal

Thank you for posting the reproduction! I need to set expectations that I'm traveling right now and will be for a couple weeks more so I won't have time personally to look in to it, but now anyone can if they have time - pull the PR and run the example - and with some instrumentation of the native code to log out API calls + their arguments, then any API call returns and the return values we can hopefully get some more information

mikehardy avatar Aug 01 '22 23:08 mikehardy

Thank you @mikehardy ! I'll also try to dig into it myself - of course I'll let you know about results :)

MateuszPrasal avatar Aug 02 '22 07:08 MateuszPrasal

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

github-actions[bot] avatar Dec 05 '22 20:12 github-actions[bot]

Same issue, any new update on this issue? This greatly affects the "show rate" report on the admob page.

Update: I did a little hacking by putting an empty ScrollView and automatically scrolling when onAdLoaded. The show rate on the AdMob page has increased significantly, but it's not perfect for me.

sontruongna avatar Jan 02 '24 08:01 sontruongna