We have the problem with our AdManger viewability measurement that it is only tracked after scrolled out of view and back again.

We brought everything back to a simple ad UI and it still does not work as expected. Does anybody see something wrong in the code?

That’s the code we are using:

    fun AdTestScreen(viewModel: AdTestViewModel = getViewModel()) {
        val adItems by viewModel.adItems.collectAsState(initial = emptyList()) // our ad information comes from the backend
        val context = LocalContext.current
        val webViews = rememberSaveable(adItems) { adItems.map { generateAdManagerAdView(context, it) } }
        LazyColumn() {
            items(webViews) { adView ->
                Text(text = "Some Lorem Ipsum text..."
                    factory = {
    fun generateAdManagerAdView(context: Context, ad: Ad) =
        AdManagerAdView(context).apply {
            adUnitId = ad.adUnitId
            doOnLayout {
                loadAd(AdManagerAdRequest.Builder().apply {
                    // some custom targeting is done

We are using the following versions:

    const val ads = "com.google.android.gms:play-services-ads:21.4.0"
    const val auth = "com.google.android.gms:play-services-auth:20.4.0"
    const val adsIdentifier = "com.google.android.gms:play-services-ads-identifier:18.0.1"
    const val kotlinVersion = "1.7.10"
    const val composeVersion = "1.2.1"
    const val composeCompilerVersion = "1.3.0"

Expected behaviour:

When the ad is displayed the measuring should start. For me this is defined as seeing many GMA Debug CONTENT .... "uri":"https://dt.adsafeprotected.com/dt?... requests in the logcat (after you enabled Google Ads Debug Mode https://support.google.com/google-ads/thread/13685676/enable-debug-logging-for-ads?hl=en). As long as the ad is displayed, the measurement calls are sent until a maximum is reached.

Current behaviour:

When the ad is displayed nothing is measured. Even when you scroll up and down (the Ad is always in a visible area), nothing is tracked. BUT: when the ad gets out of visible area and you go back, it starts measuring.

  • 71
  • 7
  • 2
    I had a not same but similar problem and found a workaround, wrote down here: https://stackoverflow.com/questions/76100292/ad-impressions-are-not-count-when-admanageradview-is-used-with-jetpack-compose/76100293#76100293 – Oya Canli Apr 25 '23 at 10:48
  • 1
    Thanks @OyaCanli ! Your workaround has fixed our issue as well! I will link you and your answer in an answer or feel free to write it by your own :) – museYke May 11 '23 at 06:43

1 Answers1


Thanks to @OyaCanli, I found a solution/workaround for this problem: Ad impressions are not count when AdManagerAdView is used with Jetpack Compose :

I found this workaround proposed in Kotlin slack for NativeAdView in Jetpack Compose, https://kotlinlang.slack.com/archives/CJLTWPH7S/p1664105063510709, and I improved it a bit. Calling adView.rootView.requestLayout() from onAdLoaded solved the issue and I see now onAdImpression is called right after onAdLoaded.

AdManagerAdView(context).apply {
    adUnitId = ad.id
    appEventListener = createAppEventListener()
    adListener = object : AdListener() {
        override fun onAdLoaded() {
  • 810
  • 1
  • 12
  • 19
  • 71
  • 7