Admob Setup

Google AdMob Setup Guide

Overview

AdMob provides banner, interstitial, and rewarded video ads for free users.


Step 1: Create AdMob Account

  1. Go to https://admob.google.com
  2. Sign in with your Google account
  3. Accept terms and conditions
  4. Complete account setup

Step 2: Create Apps in AdMob

iOS App

  1. Click "Apps" → "Add App"
  2. Platform: iOS
  3. "Is the app listed on a supported app store?": Yes (after published) or No (during development)
  4. App Name: Civix
  5. Save and note the App ID: ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY

Android App

  1. Click "Apps" → "Add App"
  2. Platform: Android
  3. App Name: Civix
  4. Save and note the App ID

Step 3: Create Ad Units

For each platform (iOS and Android), create these ad units:

Banner Ad

  1. In your app, click "Ad Units" → "Add Ad Unit"
  2. Select "Banner"
  3. Name: civix_banner
  4. Save and note the Ad Unit ID

Interstitial Ad

  1. Select "Interstitial"
  2. Name: civix_interstitial
  3. Save and note the Ad Unit ID

Rewarded Ad

  1. Select "Rewarded"
  2. Name: civix_rewarded
  3. Reward settings:
    • Reward amount: 1
    • Reward item: bonus_quiz
  4. Save and note the Ad Unit ID

Step 4: Update App Configuration

Update app.json

Replace the placeholder IDs:

{
  "expo": {
    "plugins": [
      [
        "react-native-google-mobile-ads",
        {
          "androidAppId": "ca-app-pub-XXXXXXXX~YYYYYYYY",
          "iosAppId": "ca-app-pub-XXXXXXXX~YYYYYYYY"
        }
      ]
    ]
  }
}

Update lib/ads.ts

export const AD_UNIT_IDS = {
  ios: {
    banner: "ca-app-pub-XXXXX/XXXXX",      // Your iOS banner ID
    interstitial: "ca-app-pub-XXXXX/XXXXX", // Your iOS interstitial ID
    rewarded: "ca-app-pub-XXXXX/XXXXX",     // Your iOS rewarded ID
  },
  android: {
    banner: "ca-app-pub-XXXXX/XXXXX",      // Your Android banner ID
    interstitial: "ca-app-pub-XXXXX/XXXXX", // Your Android interstitial ID
    rewarded: "ca-app-pub-XXXXX/XXXXX",     // Your Android rewarded ID
  },
};

Step 5: App-ads.txt (Required for Production)

After your app is published, add app-ads.txt to your website:

  1. Create a website or use your app's landing page
  2. Add file at: https://yourwebsite.com/app-ads.txt
  3. Content:
google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0

(Replace with your publisher ID from AdMob)


Step 6: Ad Policies

Content Guidelines

  • No incentivizing ad clicks
  • No placing ads that interfere with app functionality
  • No showing ads during gameplay interruptions without user consent
  • Rewarded ads must give actual rewards

Placement Best Practices

  • Banner: Bottom of home screen (non-intrusive)
  • Interstitial: After quiz completion (natural break point)
  • Rewarded: User-initiated "Watch ad for bonus quiz"

Step 7: Testing

Test Mode (Development)

The app uses test ad unit IDs in __DEV__ mode automatically:

  • Banner: ca-app-pub-3940256099942544/2934735716
  • Interstitial: ca-app-pub-3940256099942544/4411468910
  • Rewarded: ca-app-pub-3940256099942544/1712485313

Production Testing

  1. Add your device as a test device in AdMob
  2. Or use AdMob's built-in mediation test suite
  3. Never click your own production ads!

Ad Frequency Settings

Current settings in lib/ads.ts:

export const AD_CONFIG = {
  interstitialFrequency: 3, // Show after every 3 quizzes
  bannerRefreshRate: 60,    // Refresh banner every 60 seconds
};

Checklist

  • AdMob account created
  • iOS app created in AdMob
  • Android app created in AdMob
  • Banner ad unit created (iOS + Android)
  • Interstitial ad unit created (iOS + Android)
  • Rewarded ad unit created (iOS + Android)
  • app.json updated with App IDs
  • lib/ads.ts updated with Ad Unit IDs
  • Test ads working in development
  • app-ads.txt prepared for production