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 🙏

© 2025 – Pkg Stats / Ryan Hefner

capacitor-meta-ads

v1.0.0

Published

Capacitor plugin for Meta Audience Network ads integration with support for rewarded video and interstitial ads

Readme

capacitor-meta-ads

Capacitor plugin for Meta Audience Network ads integration with support for rewarded video and interstitial ads.

Features

  • Rewarded Video Ads - Show rewarded video ads and handle rewards
  • Interstitial Ads - Display full-screen interstitial ads
  • Test Mode Support - Easy testing with Meta's test ads
  • Event Callbacks - Comprehensive ad lifecycle events
  • Android Support - Full Android implementation
  • iOS Support - Full iOS implementation with Meta Audience Network SDK
  • AdMob Mediation - Compatible with AdMob mediation (bidding only)

Install

npm install capacitor-meta-ads
npx cap sync

Configuration

Android Setup

  1. Add Meta App ID to your android/app/src/main/AndroidManifest.xml:
<application>
    <!-- Meta Audience Network App ID -->
    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="YOUR_META_APP_ID" />
</application>
  1. For AdMob Mediation (optional - for maximum revenue):
    • Add AdMob mediation dependency: implementation 'com.google.ads.mediation:facebook:6.11.0.1'
    • Configure Meta as bidding source in AdMob console
    • Use AdMob ad units instead of direct Meta placement IDs

iOS Setup

  1. Add Meta App ID to your ios/App/App/Info.plist:
<key>FacebookAppID</key>
<string>YOUR_META_APP_ID</string>
<key>FacebookClientToken</key>
<string>YOUR_CLIENT_TOKEN</string>
  1. For AdMob Mediation (optional):
    • Add AdMob mediation dependency in your Podfile
    • Configure Meta as bidding source in AdMob console
    • Use AdMob ad units instead of direct Meta placement IDs

Usage

Initialize the SDK

import { MetaAds } from 'capacitor-meta-ads';

// Initialize with your Meta App ID
await MetaAds.initialize({
  appId: 'YOUR_META_APP_ID',
  testMode: true, // Set to false in production
});

Rewarded Video Ads

// Load a rewarded video ad
await MetaAds.loadRewardedVideo({
  placementId: 'YOUR_REWARDED_PLACEMENT_ID',
});

// Check if ad is loaded
const { loaded } = await MetaAds.isRewardedVideoLoaded();

if (loaded) {
  // Show the ad
  const result = await MetaAds.showRewardedVideo();

  if (result.success && result.reward) {
    console.log('Reward earned:', result.reward);
    // Give reward to user
  }
}

Interstitial Ads

// Load an interstitial ad
await MetaAds.loadInterstitial({
  placementId: 'YOUR_INTERSTITIAL_PLACEMENT_ID',
});

// Check if ad is loaded
const { loaded } = await MetaAds.isInterstitialLoaded();

if (loaded) {
  // Show the ad
  const result = await MetaAds.showInterstitial();

  if (result.success) {
    console.log('Interstitial ad shown successfully');
  }
}

Test Mode

// Enable test mode (should be done before initialize)
await MetaAds.setTestMode({ enabled: true });

// Add test device
await MetaAds.addTestDevice({ deviceId: 'YOUR_TEST_DEVICE_ID' });

Test Placement IDs

For testing, use Meta's test placement IDs:

  • Rewarded Video: VID_HD_16_9_46S_APP_INSTALL#YOUR_PLACEMENT_ID
  • Interstitial: IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID

For AdMob Mediation Testing:

  • Use AdMob test ad unit IDs
  • Enable test mode in both AdMob and Meta consoles
  • Register your test device in both platforms

API

initialize(...)

initialize(options: { appId: string; testMode?: boolean; }) => Promise<void>

Initialize Meta Audience Network SDK

| Param | Type | | ------------- | --------------------------------------------------- | | options | { appId: string; testMode?: boolean; } |


loadRewardedVideo(...)

loadRewardedVideo(options: { placementId: string; }) => Promise<void>

Load a rewarded video ad

| Param | Type | | ------------- | ------------------------------------- | | options | { placementId: string; } |


showRewardedVideo()

showRewardedVideo() => Promise<{ success: boolean; reward?: RewardInfo; }>

Show a rewarded video ad

Returns: Promise<{ success: boolean; reward?: RewardInfo; }>


isRewardedVideoLoaded()

isRewardedVideoLoaded() => Promise<{ loaded: boolean; }>

Check if rewarded video ad is loaded

Returns: Promise<{ loaded: boolean; }>


loadInterstitial(...)

loadInterstitial(options: { placementId: string; }) => Promise<void>

Load an interstitial ad

| Param | Type | | ------------- | ------------------------------------- | | options | { placementId: string; } |


showInterstitial()

showInterstitial() => Promise<{ success: boolean; }>

Show an interstitial ad

Returns: Promise<{ success: boolean; }>


isInterstitialLoaded()

isInterstitialLoaded() => Promise<{ loaded: boolean; }>

Check if interstitial ad is loaded

Returns: Promise<{ loaded: boolean; }>


setTestMode(...)

setTestMode(options: { enabled: boolean; }) => Promise<void>

Set test mode

| Param | Type | | ------------- | ---------------------------------- | | options | { enabled: boolean; } |


addTestDevice(...)

addTestDevice(options: { deviceId: string; }) => Promise<void>

Add test device

| Param | Type | | ------------- | ---------------------------------- | | options | { deviceId: string; } |


Interfaces

RewardInfo

| Prop | Type | | ------------ | ------------------- | | type | string | | amount | number |

Requirements

  • Android: API level 23+ (Android 6.0+)
  • Meta Audience Network SDK: 6.17.0+
  • Capacitor: 7.0.0+
  • iOS: iOS 14.0+

AdMob Mediation Support

Fully Compatible - This plugin works with AdMob mediation:

  • Meta Audience Network operates as bidding-only partner (no waterfall)
  • Increases revenue through real-time bidding competition
  • Improves fill rates across your ad inventory
  • Configure in AdMob console, not directly in app code

Setup Steps:

  1. Add mediation dependency to android/build.gradle
  2. Create mediation group in AdMob console
  3. Add Meta as bidding source
  4. Use AdMob ad unit IDs in your app

Related Plugin

For Unity Ads integration, check out our companion plugin:

Use both plugins together with AdMob mediation for maximum revenue!

License

MIT