Skip to content

GAM Manual impression ISSUE #1032

Open
Open

Description

@vivekyadav15

[Rendering API][GAM] Make manual impression counting configurable — false loses Prebid impressions, true loses viewability (and is unsupported on backfill ad units)

Summary

GamBannerEventHandler hard-codes setManualImpressionsEnabled(true) for every GAM request. Publishers cannot change it, and neither value works fully today:

Setting Prebid wins GAM wins
true (current, hard-coded) Impression counted via recordManualImpression() ✅
Active View never fires ❌
No impression pixel observed ❌ (nothing calls recordManualImpression() on this path)
false (not possible without patching) Impression never counted ❌
Active View never fires ❌
Impression + Active View counted automatically ✅

Background: how the GAM Rendering API counts impressions

  1. Prebid sends the GAM request with hb_* targeting through PublisherAdViewWrapper (AdManagerAdView).
  2. If the Prebid line item wins, its 1x1 creative fires PrebidAppEvent.
  3. GamBannerEventHandler.handleAppEvent() keeps the GAM view as a hidden proxyBanner and calls onPrebidSdkWin().
  4. BannerView.displayPrebidView() renders Prebid's own creative. The GAM view is never added to the view hierarchy.
  5. On onAdDisplayed → trackImpression() → proxyBanner.recordManualImpression().

Why true was likely chosen as the default

We could not find a documented rationale (the code arrived with #305 "Introduce Rendering API", which migrated an earlier SDK; #278 has no description).

Problems

1. Not configurable

Publishers whose GAM ad units serve backfill or mediation cannot follow Google's guidance without forking the handler.

2. true → GAM's own winning ads may not be counted

With d_imp_hdr=1 GAM returns the impression URL in manual_impression_urls for all winners. When GAM wins, the view is displayed, but nothing calls recordManualImpression(). In our test the GAM view was displayed and onAdImpression fired, but no pcs/view request was sent.

3. true → no Active View for Prebid wins

pcs/view is sent natively by GMA on recordManualImpression(). pcs/activeview is sent by Active View JS (lidar.js) inside the GAM creative's WebView and needs that view to be measured on screen. The proxy view is never attached, so Active View only loads (gen_204?id=av-js) and never reports.

4. false → Prebid wins are never counted

With manual impressions off, GAM returns impression_urls (display-triggered). The proxy view never gets a displayed pixel, so pcs/view never fires; recordManualImpression() is a no-op.

Questions for maintainers

  1. Can you confirm the original reason for hard-coding manual impressions to true?
  2. Is the missing recordManualImpression() on the GAM-win path known/intended?
  3. Would you accept a PR for configurable impression tracking, and which option for ?
  4. Any guidance on viewability?

Activity

  1. changed the title [-]GAM Manual impression[/-] [+]GAM Manual impression ISSUE[/+] on Oct 16, 2026
  2. YuriyVelichkoPI commented on Oct 22, 2026

    @YuriyVelichkoPI
    Contributor

    Hi @vivekyadav15 thank you for the report and for describing the issue during the PMC call.

    Can you confirm the original reason for hard-coding manual impressions to true?

    The reason is that we needed to track impressions when Prebid won, so this had to be handled manually. Otherwise, as mentioned in the ticket, the impression was never counted.

    Is the missing recordManualImpression() on the GAM-win path known/intended?

    This is not intended. It definitely looks like a bug.

    Would you accept a PR for configurable impression tracking, and which option for ?

    Absolutely—please open a PR.

    Any guidance on viewability?

    We do not have specific guidance at this time, as it is difficult to determine how to address the Active View issue in this scenario. At a minimum, the OM tag can be used to measure the viewability of ads rendered by the Prebid SDK.

  3. YuriyVelichkoPI commented on Oct 24, 2026

    @YuriyVelichkoPI
    Contributor

    @vivekyadav15 , please take a look @justadreamer PR's. let us know if they address your issue or there are some uncovered corner cases.

    The PR's don't solve Active View issue.

  4. vivekyadav15 commented on Nov 18, 2026

    @vivekyadav15
    Author

    @YuriyVelichkoPI I believe that with the proposed approach, the Active View (viewability) pixel might not fire, since it relies on the GAM view being part of the view hierarchy. Setting manualImpression to true may trigger the impression event, but it won't necessarily trigger the viewability pixel.
    Could we instead consider adding a GAM view and embedding the Prebid view inside it? This would be somewhat similar to how things work on the web, where the GAM iframe acts as the container and the creative iframe is rendered inside it.
    This way, we could potentially ensure that both GAM and Prebid have their respective views in the hierarchy, allowing the impression and viewability pixels to fire correctly for both.

  5. YuriyVelichkoPI commented on Nov 18, 2026

    @YuriyVelichkoPI
    Contributor

    @vivekyadav15, sure let's try this way.

    Have you already tried internally and can make PRs?

  6. vivekyadav15 commented on Nov 20, 2026

    @vivekyadav15
    Author

    @vivekyadav15, sure let's try this way.

    Have you already tried internally and can make PRs?

    Proposed Approaches: GAM Impression and Active View Measurement for Prebid Rendered Creatives

    1. Overview

    When Prebid wins, the creative is rendered by the Prebid SDK, while GAM's AdManagerAdView is not responsible for rendering the actual ad creative.

    We have identified three possible approaches based on the positioning of the Prebid creative relative to AdManagerAdView.

    2. Impression Tracking Configuration: Manual Impressions Disabled

    For the proposed approaches to work, manual impression tracking should be disabled so that GAM can handle impression counting through its automatic impression mechanism.

    Configuration:

    adManagerAdView.setManualImpressionsEnabled(false);
    

    With manual impressions disabled:

    • GAM is responsible for automatically recording impressions when its ad view meets the SDK's impression criteria.
    • We do not explicitly invoke recordManualImpression() for Prebid rendered ads.
    • The proposed view hierarchy approaches aim to keep the GAM ad view present and visible within the ad slot so that GAM can handle its own impression lifecycle.
    • AdX and direct line item demand can continue using GAM's native impression tracking without requiring separate manual impression handling.

    Important: This configuration must be applied before loading the ad.

    3. Android: Three Possible Approaches

    GAM Container: AdManagerAdView

    Approach 1: Prebid creative as the topmost view (GAM below Prebid)

    Ad Slot
    ├── AdManagerAdView
    │   └── GAM Internal Ad Content
    │
    └── Prebid Creative View  ← Topmost view
        └── Actual Prebid Ad Content
    

    Expected behavior:

    • The Prebid creative remains visible and is not obstructed by GAM's view.
    • GAM's /pcs/view impression pixel fires.
    • GAM Active View pixels (lidar2 / lidartos) fire.

    Approach 2: GAM as the topmost view (Prebid below GAM)

    Ad Slot
    ├── Prebid Creative View
    │   └── Actual Prebid Ad Content
    │
    └── AdManagerAdView  ← Topmost view
        └── GAM Internal Ad Content
    

    Expected behavior:

    • GAM's /pcs/view impression pixel fires.
    • GAM Active View pixels (lidar2 / lidartos) fire.
    • The GAM view sits above the Prebid creative and can obstruct it.

    Potential Cons:

    • The Prebid creative may be visually obstructed by the GAM view.
    • Prebid's OMID measurement may consider the GAM view an obstruction, potentially affecting viewability measurement.

    Approach 3: Prebid creative inside AdManagerAdView

    AdManagerAdView extends BaseAdView, which extends ViewGroup, making it a potential candidate for hosting the Prebid creative as a child view.

    Ad Slot
    └── AdManagerAdView
        ├── GAM Internal Ad Content
        │
        └── Prebid Creative View  ← Proposed insertion
            └── Actual Prebid Ad Content
    

    Expected behavior:

    • The Prebid creative remains inside the GAM view hierarchy.
    • GAM's /pcs/view impression pixel fires.
    • GAM Active View pixels (lidar2 / lidartos) fire.

    Potential Cons:

    • Adding a custom child view may interfere with the internal rendering lifecycle of AdManagerAdView.
    • GAM SDK operations such as loading, refreshing, or destroying the ad view may affect the inserted Prebid child view.

    4. Important Implementation Caveat: Creative Dimensions

    One important consideration across all three approaches is the size of the GAM creative associated with the Prebid line item.

    Currently, the Prebid line item can have a 1×1 creative size. Since Active View relies on the dimensions of the measured ad view, a 1×1 creative may prevent Active View from considering the ad view viewable.

    5. Open Questions

    1. Which of the three approaches is most appropriate from GMA's impression and Active View measurement perspective?
    2. Can we achieve the same behavior without compromising Prebid's OMID measurement?
    3. Does adding a child view to AdManagerAdView interfere with its native rendering lifecycle?

    6. Conclusion

    We have identified three possible approaches for integrating the Prebid creative with the GAM view hierarchy on Android.

    The common prerequisites are:

    • Manual impressions disabled, allowing GAM to handle impression counting automatically.
    • Prebid creative rendered within the proposed view hierarchy.

    At this point, we are not certain which approach is correct or officially supported by GMA. We would like feedback on the recommended view hierarchy and whether there is a supported way to achieve both GAM impression tracking and Active View measurement while preserving Prebid's own OMID measurement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions