Skip to content

Rewarded: closing a plugin-rendered ad early still grants the reward #1026

Closed

Description

@chauduyphanvu

Describe the bug
RewardedAdUnit grants the reward on every close, even when the controller is a third-party plugin renderer that decided the user did not earn it. The controller listener in BaseInterstitialAdUnit calls notifyUserReward() from onInterstitialClosed() (3.4.0: BaseInterstitialAdUnit.java:413-416; 3.3.1: :337-340; the same in 3.3.2, 3.3.4 and master). The only guard is userHasNotEarnedRewardYet, so the first close after each load always fires RewardedAdUnitListener.onUserEarnedReward.

For Prebid's own renderer this looks deliberate: InterstitialController.onAdClosed also grants the reward on close when the user was not rewarded yet (InterstitialController.java:101-105). A third-party plugin (PrebidMobilePluginRenderer, other than the built-in PrebidRenderer) owns its own reward rules and reports the reward through InterstitialControllerListener.onUserEarnedReward(). The close fallback overrides that decision, so a user who closes a plugin-rendered rewarded ad early still gets the reward.

To Reproduce

  1. Register a plugin renderer whose isSupportRenderingFor returns true for rewarded, and whose createInterstitialController returns a controller that calls onInterstitialDisplayed() and then onInterstitialClosed(), and never calls onUserEarnedReward().
  2. Load a RewardedAdUnit with a bid routed to that plugin (ext.prebid.meta.rendererName and rendererVersion match), then call show(). On 3.4.0, do not call destroy() inside onAdClosed, because that clears the listener first.
  3. Close the ad.
  4. RewardedAdUnitListener.onUserEarnedReward fires right after onAdClosed, although the controller never called onUserEarnedReward().

We hit this with the Chartboost plugin renderer. When the bid sets a reward duration and the user closes before it, the Chartboost SDK does not call its reward callback, so the plugin never calls onUserEarnedReward(). The publisher still gets Prebid's reward callback.

Expected behavior
For a third-party plugin controller, only onUserEarnedReward() grants the reward. Closing the ad does not.

Possible fix
Let a plugin declare that it reports rewards itself, for example with a default method on PrebidMobileInterstitialControllerInterface that returns false. The default keeps today's behavior for existing plugins and for PrebidRenderer. When it returns true, onInterstitialClosed() does not call notifyUserReward().

Smartphone

  • Prebid Mobile SDK: 3.3.1 and 3.4.0 (the same code in 3.3.2, 3.3.4 and master)
  • Device: Android emulator, Android 16 (API 36)

Related: #1004

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