googleads / googleads-mobile-flutter

A Flutter plugin for the Google Mobile Ads SDK
Apache License 2.0
344 stars 285 forks source link

ConsentForm performance concerns #1136

Closed NunoOliveiraP closed 4 months ago

NunoOliveiraP commented 4 months ago

Plugin Version

google_mobile_ads: ^5.1.0

We've noticed a heavy delay on Android when fetching the CMP form which varies drastically from newer phones to older phones. iOS and newer phones seem to take the "default" 2 seconds to load and show the CMP form (same for Android simulators). Older phones fare quite worse however...

Using a OnePlus 6 it took close to 5 seconds for the form to show. And using a weaker phone (Ulefone Note 7) it never even shows because the request times out every time after ~10 seconds.

Is loadAndShowConsentFormIfRequired supposed to be such a performance-heavy task? Or are these delays not normal at all?

We tested with multiple CMP forms set up (including Google's sample one) and the performance was the same, so the form itself does not seem to influence the delay, only the phones.

Any idea of what is going on? I can provide the minimal implementation used to test this, but since it only varies from phone to phone, I doubt its value.

Thanks.

malandr2 commented 4 months ago

Hi @NunoOliveiraP, requestConsentInfoUpdate() and loadAndShowConsentFormIfRequired() are considered performance-heavy that relies on WebView init. The WebView init is a heavy task (especially the 1st init call) which unfortunately will occupy the UI thread. As a result, it is inline with expectations that it's loading slower on older Android versions. We have recommended to publishers to help mitigate the burden is to only add the vendors and ad partners that you actually need.

NunoOliveiraP commented 4 months ago

Thanks @malandr2, we'll see what we can do from our end.