AdMob: show-time placement override persists after the ad is loaded again

Open Beginner friendly
#2,104 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #2105 by @RaphaelFakhri — merged

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react-native, typescript
Domain
mobile

Research direction

Start in the react-native-purchases-admob JavaScript layer and trace where TrackedAdState.showPlacement is set in prepareShow and where a new ad load is handled. Check the existing tests for reloading and showing an InterstitialAd or AppOpenAd; done means a show-time placement affects only that impression, and a subsequent show without an override uses the load-time placement for impression, click, and revenue events.

Written by the indexing model from the issue text.

Description

Describe the bug

In react-native-purchases-admob, the placement passed to RevenueCatAdMob.showAndTrack (or showWithRewardVerification) is stored on the ad's tracking state and never cleared. The README describes it as overriding the load-time placement "for this impression", but when the same InterstitialAd or AppOpenAd is loaded again and shown without a show-time placement, the next impression, click and revenue events still report the old override instead of the load-time placement.

Reloading the same ad object after CLOSED is the usual pattern with react-native-google-mobile-ads, so ad events end up attributed to the wrong placement.

  1. Environment

    1. Platform: iOS and Android (JS layer)
    2. SDK version: react-native-purchases-admob 11.0.0
    3. React Native version: any
  2. Steps to reproduce

const ad = RevenueCatAdMob.createInterstitialAd(unitId, { placement: "home" });
ad.load();
// after LOADED
await RevenueCatAdMob.showAndTrack(ad, { placement: "home_retry" });
// after CLOSED
ad.load();
// after LOADED
await RevenueCatAdMob.showAndTrack(ad);
  • Expected: the second impression is tracked with placement: "home".
  • Actual: the second impression is tracked with placement: "home_retry".
  1. Other information

TrackedAdState.showPlacement is set in prepareShow and only read afterwards. Clearing it when a new ad is loaded keeps the override scoped to one impression.

Dominant language
TypeScript
Stars
1.2k
Forks
124
Avg merge
1d 3h
Merged PRs (30d)
69

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RevenueCat/react-native-purchases

All issues in RevenueCat/react-native-purchases

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.