AdMob Setup: Step-by-Step Guide

Step 1: Create an AdMob Account

  1. Sign Up: Go to the AdMob website and sign up with your Google account if you don’t have an account already.
  2. Set Up AdMob: Once you’ve signed in, AdMob will guide you through the process of linking your AdMob account to your Google account.

Step 2: Create a New AdMob App

  1. Add Your App:

    • Go to the Apps section in the AdMob dashboard.
    • Click on Add App.
    • Choose whether your app is published or not.
      • If your app is published, select it from the store (Google Play for Android, App Store for iOS).
      • If not, enter the app name manually.
    • Choose Android or iOS as your platform.
  2. Get the App ID: Once the app is added, you’ll receive an App ID. You’ll need this later to configure AdMob in your code.

Step 3: Add Ad Units

  1. Create Ad Units:

    • After creating your app, go to the Ad Units section.
    • Click on Add ad unit.
    • Choose the ad format you want to implement (e.g., Banner, Interstitial, Rewarded, Native).
    • Follow the steps to create the ad unit, then you’ll receive an Ad Unit ID. This will be required when integrating ads in your app.
  2. Save the Ad Unit IDs: For each ad unit you create, save the generated Ad Unit ID. This will be used in your app’s code to load ads.

Step 4: Integrate AdMob into Your App

For Android:

  1. Add AdMob App ID to AndroidManifest.xml:

    • Open your AndroidManifest.xml file, and inside the <application> tag, add the following metadata:

      <meta-data
          android:name="com.google.android.gms.ads.APPLICATION_ID"
          android:value="your-admob-app-id" />
      
  2. Load Ads in config file:

For iOS:

  1. Add AdMob App ID to Info.plist:
    • In your Info.plist file, add a new key for GADApplicationIdentifier:

      <key>GADApplicationIdentifier</key>
      <string>your-admob-app-id</string>
      

Step 4: Test Ads in Development

  1. Enable Test Ads:

    • Google provides test ads to avoid accidentally clicking your own ads, which can violate AdMob policies.
    • For Android, you can enable test ads using your device ID or by using Google’s test ad units. Refer to AdMob test ads documentation for details.
  2. Test Ads in Your App:

    • Run your app and ensure that the test ads load correctly.

Conclusion:

With this guide, you've set up AdMob in your Android or iOS app, created ad units, and integrated ads. Ensure that you always use test ads in development and monitor ad performance via the AdMob dashboard for optimization.