Skip to content

[πŸ›] Meta Audience Network config options (metaAdvertiserTrackingEnabled, metaAudienceNetworkEnabled) are silently ignored by Expo pluginΒ #828

@ponljung

Description

@ponljung

What happened?

Issue 1: Config options silently ignored

The Expo config plugin for react-native-google-mobile-ads accepts Meta Audience Network configuration options in app.json, but these options are silently ignored and never applied to native code.

I verified this by reading the plugin source at node_modules/react-native-google-mobile-ads/plugin/src/index.ts. The PluginParameters type only defines:

  • androidAppId, iosAppId, delayAppMeasurementInit, optimizeInitialization, optimizeAdLoading, skAdNetworkItems, userTrackingUsageDescription

The metaAdvertiserTrackingEnabled, metaAudienceNetworkEnabled, and metaDataProcessingOptions options I'm passing are not processed - no warning, no error, just silently dropped.

Issue 2: Meta ads fail despite correct setup

According to https://developers.google.com/admob/ios/mediation/meta, FBAdSettings.setAdvertiserTrackingEnabled() must be called prior to initializing the Google Mobile Ads SDK.

With the current library, there is no way to call this without adding a separate package like react-native-fbsdk-next.

Evidence from Ad Inspector:

When forcing Meta ads via Ad Inspector on a registered test device:

  1. Meta WINS the bidding at $99.99 CPM
  2. Adapter is called: GADMediationAdapterFacebook
  3. But no ad is returned

From the ad response bidding_data:
{"buyer_network_id": 1418116, "external_label": "Won", "external_description": "Won the auction."},
{"buyer_network_id": 2244222, "external_label": "No ad returned", "external_description": "Go to Help for details."}

Configuration verified as correct

  • Meta added to AdMob GDPR ad partners
  • Additional Consent string includes Meta ID (89)
  • Meta Business Manager placements verified & serving
  • Meta adapter installed (iOS: GoogleMobileAdsMediationFacebook, Android: com.google.ads.mediation:facebook:6.21.0.0)
  • 80+ SKAdNetwork IDs configured
  • ATT permission requested and granted
  • Test device registered in AdMob
  • UMP consent obtained

The exact same production build works on some devices (Meta ads display correctly) but fails on others. The only difference we can identify is that the library doesn't call setAdvertiserTrackingEnabled(), and some devices may have cached state from previous Meta SDK interactions.

Expected behavior

Either:

  1. The plugin should call FBAdSettings.setAdvertiserTrackingEnabled() based on the metaAdvertiserTrackingEnabled config value
  2. OR the plugin should warn/error when unknown options are passed
  3. OR documentation should clarify these options don't exist and explain how to properly configure Meta mediation

Platforms

Android and iOS

React Native Info

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 22.15.0
    npm: 10.9.2
  npmPackages:
    expo: ^54.0.0 => 54.0.27
    expo-router: ~6.0.17 => 6.0.17
    expo-updates: ~29.0.14 => 29.0.14
    react: 19.1.0 => 19.1.0
    react-dom: 19.1.0 => 19.1.0
    react-native: 0.81.5 => 0.81.5
    react-native-google-mobile-ads: 15.8.3
  npmGlobalPackages:
    eas-cli: 16.13.1
  Expo Workflow: bare (using Continuous Native Generation)

  iOS testing: iPhone 15 Pro Max (iOS 26+), via TestFlight/App Store.
  Android testing: Various devices via Google Play internal testing.

Are your using Typescript?

  • My project is using Typescript

package.json

{
    "name": "my-app",
    "main": "expo-router/entry",
    "version": "1.0.0",
    "dependencies": {
      "expo": "^54.0.0",
      "expo-build-properties": "~1.0.10",
      "expo-tracking-transparency": "~6.0.8",
      "react": "19.1.0",
      "react-native": "0.81.5",
      "react-native-google-mobile-ads": "15.8.3"
    }
  }

app.json

{
    "expo": {
      "plugins": [
        [
          "react-native-google-mobile-ads",
          {
            "androidAppId": "ca-app-pub-XXXXXXXX~XXXXXXXX",
            "iosAppId": "ca-app-pub-XXXXXXXX~XXXXXXXX",
            "metaAdvertiserTrackingEnabled": true,
            "metaDataProcessingOptions": [],
            "metaAudienceNetworkEnabled": true,
            "userTrackingUsageDescription": "This app uses your data to provide personalized ads and improve your experience."
          }
        ],
        [
          "expo-build-properties",
          {
            "android": {
              "dependencies": [
                "com.google.ads.mediation:facebook:6.21.0.0"
              ],
              "extraProguardRules": "-keep class com.google.ads.mediation.facebook.** { *; }\n-keep class com.facebook.ads.** { *; }"
            },
            "ios": {
              "useFrameworks": "static",
              "extraPods": [
                {
                  "name": "GoogleMobileAdsMediationFacebook",
                  "configurations": ["Release", "Debug"]
                }
              ]
            }
          }
        ],
        "expo-tracking-transparency"
      ]
    }
  }

ios/Podfile

Not committed - using Expo CNG (Continuous Native Generation). iOS folder is generated at build time via expo prebuild.

android/build.gradle

buildscript {
    repositories {
      google()
      mavenCentral()
    }
    dependencies {
      classpath 'com.google.gms:google-services:4.4.1'
      classpath('com.android.tools.build:gradle')
      classpath('com.facebook.react:react-native-gradle-plugin')
      classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
    }
  }

  allprojects {
    repositories {
      google()
      mavenCentral()
      maven { url 'https://www.jitpack.io' }
    }
  }

  apply plugin: "expo-root-project"
  apply plugin: "com.facebook.react.rootproject"

android/app/build.gradle

android {
      namespace 'com.example.myapp'
      defaultConfig {
          applicationId 'com.example.myapp'
          minSdkVersion rootProject.ext.minSdkVersion
          targetSdkVersion rootProject.ext.targetSdkVersion
          versionCode 51
          versionName "3.1.2"
      }
  }

  dependencies {
      implementation("com.facebook.react:react-android")

      // GAID for Meta mediation
      implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")

      // Meta Audience Network mediation adapter for AdMob
      implementation("com.google.ads.mediation:facebook:6.21.0.0")
  }

  apply plugin: 'com.google.gms.google-services'

android/settings.gradle

pluginManagement {
    // ... standard Expo/RN config
  }

  plugins {
    id("com.facebook.react.settings")
    id("expo-autolinking-settings")
  }

  rootProject.name = 'MyApp'
  include ':app'

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

    <application>
      <meta-data 
        android:name="com.google.android.gms.ads.APPLICATION_ID" 
        android:value="ca-app-pub-XXXXXXXX~XXXXXXXX"/>
      <meta-data 
        android:name="com.google.android.gms.ads.flag.OPTIMIZE_AD_LOADING" 
        android:value="true"/>
      <meta-data 
        android:name="com.google.android.gms.ads.flag.OPTIMIZE_INITIALIZATION" 
        android:value="true"/>
    </application>
  </manifest>

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions