npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rediads/react-native-ads-gam

v0.1.0

Published

Rediads bids in Google Ad Manager for React Native apps: SDK-rendered (GAM decides, the Rediads SDK draws a Rediads win) or bidding only (the hb_ keys for your GAM requests, GAM draws).

Readme

@rediads/react-native-ads-gam

Rediads bids in Google Ad Manager (GAM) for React Native apps on iOS and Android (Expo, or bare with Expo modules support). Before each GAM request the package runs the Rediads auction and adds the bid's keys to the request (hb_pb price bucket, hb_bidder, hb_cache_id, ...). GAM runs its own auction and decides. Two modes, per slot:

| | SDK-rendered (RediadsGAMBanner, RediadsGAMInterstitial, RediadsGAMRewarded) | Bidding only (RediadsGAM.fetchTargeting, RediadsGAM*BiddingOnly) | |---|---|---| | Who draws a Rediads win | The Rediads SDK, with Rediads trackers, MRAID and video | GAM: the Prebid Universal Creative loads the bid from the Rediads cache | | Rediads impression and viewability | Yes | Not yet | | GAM creative for Rediads line items | Prebid's "app event" creative, line items targeting rediads_render = sdk | Universal Creative (SafeFrame off), line items excluding rediads_render = sdk | | Banner refresh | Automatic (refreshInterval) | Load again (a new key) | | Loads GAM through react-native-google-mobile-ads | No (the SDK loads GAM; both can be in one app) | Yes, through fetchTargeting |

Every request from the SDK-rendered classes carries rediads_render=sdk.

import { RediadsAds } from '@rediads/react-native-ads';
import { RediadsGAM, RediadsGAMBanner, RediadsGAMInterstitial } from '@rediads/react-native-ads-gam';

await RediadsAds.start({ accountId: 'YOUR_ACCOUNT_ID' });
await RediadsGAM.start();

<RediadsGAMBanner placement="home_mrec" adUnitId="/NETWORK_CODE/home_mrec" size="300x250" />;
const ad = new RediadsGAMInterstitial('level_end', '/NETWORK_CODE/level_end');
if ((await ad.load()) === null) await ad.show();

// Bidding only, keys for another GAM library
const { targeting } = await RediadsGAM.fetchTargeting({ type: 'banner', placement: 'home_mrec' });

Requirements

  • @rediads/react-native-ads of the same version (it starts the Rediads SDK).
  • Expo SDK 58 or later (React Native 0.88): an Expo app, or a bare React Native app with Expo modules.
  • iOS 16.4 or later, and a development build (not Expo Go).
  • Supported: Android 10+ (builds with minSdk 24; ads stay off below Android 10). Below Android 10, start, every load and every banner answer with the error "Android 10 or newer is needed (this device runs API N); the Rediads SDK stays off." (the Android SDK's UNSUPPORTED_OS), without a request; in the AdMob and GAM packages it comes as the bid event's error and Google's ad still loads. Nothing to fix in the app.
  • Google's Mobile Ads SDK: the app's own version is used and never raised. iOS 12.0.0 or later, Android (play-services-ads) 23.0.0 or later. See Google's Mobile Ads SDK.

Install

Expo apps

npm install @rediads/react-native-ads @rediads/react-native-ads-gam

In app.json:

"plugins": [
  "@rediads/react-native-ads",
  ["@rediads/react-native-ads-gam", {
    "iosAppId": "ca-app-pub-XXXX~YYYY",
    "androidAppId": "ca-app-pub-XXXX~ZZZZ"
  }]
]

Then a development build: npx expo prebuild --clean, then npx expo run:ios and npx expo run:android, or eas build --profile development.

  • The app IDs (Ad Manager → Inventory → Apps, or AdMob) are optional: without them the plugin marks the app as an Ad Manager app (GADIsAdManagerApp, com.google.android.gms.ads.AD_MANAGER_APP), which Google's SDK accepts instead of an ID. If another plugin sets the app ID (react-native-google-mobile-ads, @rediads/react-native-ads-admob), give the same ID here.
  • Like @rediads/react-native-ads, the plugin adds Rediads' pod list to the Podfile sources (once). On Android the SDK comes from Maven Central; for Google's SDK see Google's Mobile Ads SDK.

Bare React Native apps

  1. Set up @rediads/react-native-ads first (Expo modules, the two Podfile source lines; see its README).
  2. npm install @rediads/react-native-ads-gam
  3. iOS: in Info.plist, GADApplicationIdentifier = your app ID, or GADIsAdManagerApp = YES; and Google's SKAdNetwork ID cstr6suwn9.skadnetwork in SKAdNetworkItems. Then cd ios && pod install.
  4. Android: in AndroidManifest.xml, inside <application>, either <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-XXXX~ZZZZ"/> or <meta-data android:name="com.google.android.gms.ads.AD_MANAGER_APP" android:value="true"/>.

What gets installed

The JavaScript API (compiled, with types), the native bridge as Swift and Kotlin source, and the Rediads SDK's GAM part as binaries: on iOS the pod RediadsGAM 0.1.4 (with RediadsGAMEventHandlers), on Android com.rediads:rediads-gam:0.1.1 (with its event handlers). Google's Mobile Ads SDK is the app's own: see below.

Google's Mobile Ads SDK

A publisher keeps its own version of Google's Mobile Ads SDK; the Rediads packages never raise it.

  • iOS: the pods ask for Google-Mobile-Ads-SDK 12.0.0 or later. CocoaPods uses the version the app (or react-native-google-mobile-ads) pins; with nothing pinned it takes the newest.
  • Android: the Rediads SDK (0.1.1) doesn't bring play-services-ads; it works with 23.0.0 or later. The version the app (or react-native-google-mobile-ads) asks for is used, even an older one. Only when nothing in the app asks for play-services-ads does this package add one: 25.5.0, as a Gradle "prefer" (the weakest kind, so any other declaration wins). To prefer another version, or to add nothing ("none", when the app brings play-services-ads some other way), set the config plugin's androidGoogleMobileAdsVersion option ("25.5.0", "24.6.0", "none"), or in a bare app the Gradle property rediadsGoogleMobileAdsVersion in android/gradle.properties.
  • Below 23.0.0 on Android the Rediads SDK logs an error and gets no Rediads bids; Google's ads still load.

With react-native-google-mobile-ads

An app can keep react-native-google-mobile-ads for its other ads, consent and initialization: both packages use the one copy of Google's Mobile Ads SDK.

  • Versions: react-native-google-mobile-ads 17.1 or later (the versions for React Native 0.88). It pins Google's SDK exactly (17.4.0: iOS 13.10.0, Android 25.5.0), and that pin is what the app gets on both platforms: the Rediads pods take Google's SDK 12.0.0 or later, and on Android this package's own play-services-ads is only a "prefer", which the pin overrides. A react-native-google-mobile-ads release that moves to Google's SDK 14 needs a Rediads release that supports it.
  • App IDs: give them once, in either plugin. An ID given only to react-native-google-mobile-ads's plugin is used by this one too; two different IDs stop expo prebuild with an error. With react-native-google-mobile-ads in the app the IDs are required: its library manifest declares the app ID item, so the Ad Manager flag alone isn't enough.
  • Android: keep react-native-google-mobile-ads on Google's classic SDK (its androidSdk option "classic", the default). Its "nextgen" option replaces play-services-ads, which the Rediads SDK is built on; the Android build then stops with an error that says so.
  • Starting Google's SDK: mobileAds().initialize() or RediadsGAM.start(), or both.
  • Test devices: RediadsGAM.start({ testDeviceIds }) replaces the list set with mobileAds().setRequestConfiguration(); set it in one place.
  • Consent: AdsConsent (Google's UMP) stores the standard IAB consent strings, which the Rediads SDK reads. Gather consent before the first ad loads.
  • Bare React Native apps: set each app ID once. On Android, react-native-google-mobile-ads's library manifest declares the app ID item from its app.json key; if the app's AndroidManifest.xml declares it too, add tools:replace="android:value" to that item.

SDK-rendered

import { RediadsAds } from '@rediads/react-native-ads';
import { RediadsGAM, RediadsGAMBanner, RediadsGAMInterstitial, RediadsGAMRewarded } from '@rediads/react-native-ads-gam';

await RediadsAds.start({ accountId: 'YOUR_ACCOUNT_ID' });
await RediadsGAM.start();             // Google's SDK; skip if another library starts it

// Refreshes itself every 60 s (refreshInterval: 15 to 120), each time with a new auction
<RediadsGAMBanner placement="home_mrec" adUnitId="/NETWORK_CODE/home_mrec" size="300x250"
  format="video" onAdEvent={(e) => e.type === 'loaded' && console.log('drawn by', e.renderer)} />

const interstitial = new RediadsGAMInterstitial('level_end', '/NETWORK_CODE/level_end');
if ((await interstitial.load()) === null) await interstitial.show();   // shows whichever ad won

const rewarded = new RediadsGAMRewarded('extra_life', '/NETWORK_CODE/extra_life',
  { type: 'lives', amount: 1 }, { format: 'video' });
rewarded.addListener((e) => { if (e.type === 'rewarded') grantLives(e.reward!.amount); });  // your reward
  • Events are those of @rediads/react-native-ads (loaded, displayed, failed, clicked, presented, dismissed, leftApplication, rewarded), whichever ad won. loaded carries renderer: rediads when a Rediads line item won and the Rediads SDK draws the ad, gam when GAM's demand won and Google's view shows it. Full-screen ads also have renderer().
  • Rewarded hands back your reward once, whoever won: a Rediads ad by the Rediads rules (video at completion, display after displaySeconds), GAM's when Google reports it. The GAM ad unit must be a rewarded ad unit whose Rediads line items use Prebid's rewarded app-event VAST.

Bidding only

  1. Only the keys, for apps that already load GAM ads with react-native-google-mobile-ads (or another library). Its request options take custom targeting, so the keys go straight in:

    import { RediadsGAM } from '@rediads/react-native-ads-gam';
    import { GAMBannerAd, BannerAdSize } from 'react-native-google-mobile-ads';
    
    const { targeting, error } = await RediadsGAM.fetchTargeting({ type: 'banner', placement: 'home_mrec', size: '300x250' });
    <GAMBannerAd unitId="/NETWORK_CODE/home_mrec" sizes={[BannerAdSize.MEDIUM_RECTANGLE]}
      requestOptions={{ customTargeting: targeting }} />
    
    // Interstitial / rewarded: { type: 'interstitial', placement, format } / { type: 'rewarded', placement }

    Load GAM whatever the result (targeting is empty without a bid), and fetch again for each request: a bid serves once.

  2. GAM ads loaded by this package, with the SDK's bidding-only classes:

    import {
      RediadsGAMBannerBiddingOnly,
      RediadsGAMInterstitialBiddingOnly,
      RediadsGAMRewardedBiddingOnly,
    } from '@rediads/react-native-ads-gam';
    
    // Loads once; a new `key` loads a new banner with a new bid
    <RediadsGAMBannerBiddingOnly key={refreshCount} placement="home_mrec" adUnitId="/NETWORK_CODE/home_mrec"
      size="300x250" onAdEvent={(e) => console.log(e)} />
    
    const interstitial = new RediadsGAMInterstitialBiddingOnly('level_end', '/NETWORK_CODE/level_end', { format: 'video' });
    if ((await interstitial.load()) === null) await interstitial.show();
    
    const rewarded = new RediadsGAMRewardedBiddingOnly('extra_life', '/NETWORK_CODE/extra_life');   // video bids
    rewarded.addListener((e) => { if (e.type === 'rewarded') grantReward(); });   // the GAM ad unit's reward

    Events: bid (with targeting, the keys added, or error), loaded (with GAM's lineItemId and creativeId), failed, impression, clicked, presented, dismissed, rewarded (with reward).

API

| | | |---|---| | RediadsGAM.start({ testDeviceIds }) | Starts Google's SDK | | RediadsGAM.fetchTargeting({ type, placement, size, format }) | Bidding only: { targeting, error }; type banner, interstitial or rewarded | | RediadsGAM.isAvailable, .googleSdkVersion, .PACKAGE_VERSION | | | <RediadsGAMBanner placement adUnitId size format refreshInterval onAdEvent /> | SDK-rendered; 320x50 or 300x250 | | new RediadsGAMInterstitial(placement, adUnitId, { format }) | SDK-rendered: load(), isReady(), renderer(), show(), addListener(), destroy() | | new RediadsGAMRewarded(placement, adUnitId, reward, { format, displaySeconds }) | The same | | <RediadsGAMBannerBiddingOnly placement adUnitId size format onAdEvent /> | Bidding only; loads once | | new RediadsGAMInterstitialBiddingOnly(placement, adUnitId, { format }) | Bidding only: load(), isReady(), show(), addListener(), destroy() | | new RediadsGAMRewardedBiddingOnly(placement, adUnitId) | The same; video bids |

Config plugin options

iosAppId and androidAppId (optional, see above), and, for SDK development only, iosSdkPath: a local iOS SDK checkout (the same as @rediads/react-native-ads's), from which the RediadsGAM and RediadsGAMEventHandlers pods are then taken by path.

License

Apache-2.0