# Go live with monetization in your feeds, apps, and partner pages

Earn from your feeds, your app, and partner pages: let Genuin place sponsored and programmatic video in your feeds, show an IAB Standard Size Experience from a tag in your app, or run your posts on a partner page.

Monetization is configured in Brand Control Center: the ad server, floors, authorized sellers, sponsorships, and creatives. The developer's part is to give ads a place to render, and there are three places. Pick the one that matches where your audience is, and going live is one step away.

| Surface | Where it runs | What you do | What Genuin does |
| --- | --- | --- | --- |
| In-feed ads | Inside embeds and placements, on the web and in iOS and Android apps | Add the embed. Optionally pass targeting. | Inserts ad items into the feed and plays them in the player |
| IAB ad unit | A fixed-size slot in your Android, iOS, or React Native app | Place an ad view with a tag ID | Fetches the tag's creatives, renders, tracks the impression |
| Ad creative | A partner's web page or ad server | Paste the generated code | Renders up to ten of your posts as a video unit |

## Before you begin

| You need | For | Where to get it |
| --- | --- | --- |
| Brand API key | Every SDK | Brand Control Center: Build > Publish Brand Community > SDK Integration, with a key per environment (Live, QA). Keep it out of source control. |
| Ad configuration | In-feed ads | Your team sets up the ad server and sponsorships in Brand Control Center under Monetize. Nothing in your code turns ads on or off. |
| Tag ID | IAB ad units | The id of an IAB Standard Tag, created under Grow > Off Site > Extended > IAB Standard Tag and accepted for your brand. Your Genuin team passes it to you. |
| Ad creative code | Ad creatives | Grow > Off Site > Ad Creatives > View Code in Brand Control Center |

## Path A: Let ads run inside your embeds

On every surface the same thing happens: the feed Genuin returns for an embed or a placement carries ad items next to the videos, and the player renders them. There's no ad-specific setup in your code.

### Web

Add the embed as in [Embed the Genuin Web SDK on your website](https://begenuin.com/developers/developer-resources/sdk/how-do-you-embed-and-configure-the-genuin-web-sdk-on-your-website). The SDK reads the page's `<meta name="keywords">`, the page URL, and a geo-IP location on its own and sends them with every feed and ad request. Pass `targeting` to override them or to add the key-values your sponsorships target on:

```html title="index.html"
<div id="gen-sdk" class="gen-sdk-class" style="width: 100%; height: 600px;"></div>
<script src="https://media.begenuin.com/sdk/2.0.6/gen_sdk.min.js"></script>
<script>
  window.genuin.init({
    container_id: "gen-sdk",
    embed_id: "{{EMBED_ID}}",
    api_key: "<<YOUR_API_KEY>>",
    targeting: {
      keywords: ["trail running", "race recaps"],
      page_url: "https://www.example.com/articles/ridge-50k",
      key_value: { genre: "sports", section: "running" }
    }
  });
</script>
```

| Field | Type | Default | Notes |
| --- | --- | --- | --- |
| keywords | string or string[] | The page's <meta name="keywords"> | Up to 100 keywords of 256 characters each. A comma-separated string is split and de-duplicated. |
| location | object | Geo-IP | Any subset of the location fields overrides the lookup. |
| page_url | string | window.location | Up to 2,048 characters. |
| key_value | object | none | Up to 50 entries, keys up to 128 characters, values up to 1,024. Use the keys your sponsorship targeting is configured with. |
| sponsorship_id | string[] | The embed's own sponsorship | A separate init option that overrides the sponsorship attached to the embed or placement. |

`update({ container_id, targeting })` replaces the whole `targeting` object, so a field you leave out is cleared.

### iOS and Android apps

Embeds in the Genuin Experiences SDKs carry the same ad items. Two platform declarations are needed before personalized ads serve:

- **Android**: declare the advertising ID permission, `com.google.android.gms.permission.AD_ID`, and answer the Advertising ID questionnaire in Google Play Console. See [Integrate the Genuin Android SDK](https://begenuin.com/developers/developer-resources/sdk/how-to-integrate-and-power-your-brand-community-in-android-apps).
- **iOS**: request tracking authorization with `ATTrackingManager.requestTrackingAuthorization` and declare Advertising Data in App Store Connect. Without authorization the advertising identifier is zeroed and personalized ads don't serve. See [Integrate the Genuin iOS SDK](https://begenuin.com/developers/developer-resources/sdk/developer/genuin-sdk/native-compatibility/ios/how-to-integrate-and-power-your-brand-community-in-ios-apps).

## Path B: Show an IAB Standard Size Experience in your app

The IAB Standard Size Experience SDK renders tag-driven IAB units (Interactive Advertising Bureau standard sizes such as 300×250 and 320×50). It's a separate family from the Genuin Experiences SDKs. On Android it's `com.begenuin:genuin-sdk`, `feed`, `instream-ads`, and `core-v3` (0.v3.11). On iOS it's the `GenuinSDK` and `GenuinInStreamAds` products of the `genuininc/ios_sdk` package (0.0.5). In React Native it's `genuin-react-native-ads-v3` (1.4.0, Android only). The two families can live in one app.

### Step 1: Add the SDK

- **Android**: add the four artifacts from Maven Central at one version, plus the Google Interactive Media Ads prerequisites. See [Add IAB Standard Size Experiences to an Android app](https://begenuin.com/developers/developer-resources/sdk/integrate-the-genuin-ad-sdk-for-android).
- **iOS**: add the Swift package `https://github.com/genuininc/ios_sdk` and the Google IMA package. See [Add IAB Standard Size Experiences to an iOS app](https://begenuin.com/developers/developer-resources/sdk/integrate-the-genuin-ad-sdk-for-ios).
- **React Native**: `npm install genuin-react-native-ads-v3`. See [Add IAB Standard Size Experiences to a React Native app](https://begenuin.com/developers/developer-resources/sdk/integrate-ads-with-react-native-sdk).

### Step 2: Initialize once at launch

Initialize before any ad view is created. On Android a slot that composes first throws `IllegalStateException: SDK not initialized`; on iOS a view without the ads module fails with `BGTagError.adsManagerUnavailable`.

```kotlin title="MyApp.kt"
import android.app.Application
import com.begenuin.core.enums.GenuinEnv
import com.begenuin.sdk.GenuinSDK

class MyApp : Application() {
  override fun onCreate() {
    super.onCreate()
    GenuinSDK.initialize(
      context = this,
      apiKey = BuildConfig.GENUIN_API_KEY,   // injected at build time, never a literal
      env = GenuinEnv.PROD                   // GenuinEnv.QA only with a QA key
    )
  }
}
```

```swift title="MyApp.swift"
import SwiftUI
import GenuinSDK
import GenuinInStreamAds

@main
struct MyApp: App {
    init() {
        Genuin.shared.initialize(
            modules: [BGInStreamAds.module],
            apiKey: "<<YOUR_API_KEY>>",
            config: BGSDKConfig(navigationStyle: .system, environment: .prod)
        ) { result in
            if case .failure(let error) = result { print("Genuin init failed: \(error)") }
        }
    }
    var body: some Scene { WindowGroup { ContentView() } }
}
```

```tsx title="App.tsx"
import { useEffect, useState } from 'react';
import { Platform } from 'react-native';
import { initialize } from 'genuin-react-native-ads-v3';

export function useGenuinAds(): boolean {
  const [ready, setReady] = useState(false);
  useEffect(() => {
    if (Platform.OS !== 'android') return;
    initialize({ apiKey: '<<YOUR_API_KEY>>', env: 'PROD' })
      .then(() => setReady(true))
      .catch(console.error);
  }, []);
  return ready;
}
```

### Step 3: Place the ad view

Pick the view that matches the slot size and pass the tag ID. The view fetches the tag's creatives, renders, and tracks the impression. Each view fixes its own height and takes the width of its container.

```kotlin title="ArticleScreen.kt"
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.begenuin.feed.views.BG300x250AdView

@Composable
fun ArticleScreen() {
  Column {
    ArticleBody()
    BG300x250AdView(tagId = "{{TAG_ID}}", modifier = Modifier.fillMaxWidth())
  }
}
```

```swift title="AdView.swift"
import SwiftUI
import GenuinInStreamAds
import Core

struct ContentView: View {
    var body: some View {
        VStack {
            BGNavigationRoot {
                BG300x250AdView(tagID: "{{TAG_ID}}")
            }
        }
        .padding()
    }
}
```

```tsx title="ArticleScreen.tsx"
import { GenuinAd, GenuinAdFormat } from 'genuin-react-native-ads-v3';

export default function ArticleScreen() {
  const ready = useGenuinAds();
  return (
    <>
      <ArticleBody />
      {ready && <GenuinAd tagId="{{TAG_ID}}" format={GenuinAdFormat.SIZE_300X250} />}
    </>
  );
}
```

| Size | Android composable | iOS view | Typical use |
| --- | --- | --- | --- |
| 320 × 50 | BG320x50AdView | BG320x50AdView | Standard banner |
| 320 × 100 | BG320x100AdView | BG320x100AdView | Large banner |
| 300 × 250 | BG300x250AdView | BG300x250AdView | Medium rectangle, the default |
| 300 × 250 collapsing to 300 × 50 | BGCollapsibleAdView | BGCollapsibleAdView | Collapsible unit |
| 320 × 480 | BG320x480AdView | BG320x480AdView | Half-page portrait |
| 300 × 600 | BG300x600AdView | BG300x600AdView | Half-page filmstrip |
| 1280 × 720 | BG1280x720AdView | — | Fixed 16:9 landscape |
| Fills its box | BGFSLandscapeAdView | — | Flexible landscape |

In React Native the `format` prop takes a `GenuinAdFormat` constant named after the size and defaults to `SIZE_300X250`. Each view reports lifecycle events you can observe (`onEvent` on Android, a `BGAdDelegate` on iOS, `onAdEvent` in React Native); the SDK tracks impressions on its own.

## Path C: Run your posts on a partner page

An ad creative packages up to ten approved posts as a 300×600 or 300×250 video ad unit that any web page or ad server can run. Create it in Brand Control Center under **Grow** > **Off Site** > **Ad Creatives**, then copy the code from **View Code**. Don't retype it: it carries the creative's id and the current script URL.

```html title="creative.html"
<script src="https://tpc.googlesyndication.com/pagead/gadgets/html5/api/exitapi.js"></script>
<div class="gen-ext" data-tag-id="{{AD_CREATIVE_ID}}" style="width: 300px; height: 600px;"></div>
<script src="<<GENUIN_OFFSITE_SCRIPT_URL>>" defer></script>
<script>
  document.addEventListener('click', function (e) {
    if (e.target.closest('[data-cta="true"]') && typeof ExitApi !== 'undefined') ExitApi.exit();
  });
</script>
```

The script finds every `gen-ext` container on the page and loads each creative by its `data-tag-id`. It picks the layout from the container size, plays the posts muted, and shows the call to action after the delay you set. Uploaded as an HTML5 creative in Google Ad Manager, the call-to-action click reaches Google's Exit API and counts as the click-through. Each post's pixel URL fires when that post plays, and every player event reaches Genuin's analytics.

## Limitations

- **Ads are configured in Brand Control Center, not in code.** No SDK call turns in-feed ads on, sets floors, or picks a demand source.
- **Tag IDs aren't self-serve.** Brand Control Center creates IAB Standard Tags as proposals between brands; the id reaches your app through your Genuin team.
- **React Native renders ad units on Android only** in 1.4.0.
- **Ad creatives come in two sizes.** The 320-wide banner sizes exist only as IAB Standard Tags.

## See also

- [Embed the Genuin Web SDK on your website](https://begenuin.com/developers/developer-resources/sdk/how-do-you-embed-and-configure-the-genuin-web-sdk-on-your-website)
- [Add IAB Standard Size Experiences to an Android app](https://begenuin.com/developers/developer-resources/sdk/integrate-the-genuin-ad-sdk-for-android)
- [Add IAB Standard Size Experiences to an iOS app](https://begenuin.com/developers/developer-resources/sdk/integrate-the-genuin-ad-sdk-for-ios)
- [Add IAB Standard Size Experiences to a React Native app](https://begenuin.com/developers/developer-resources/sdk/integrate-ads-with-react-native-sdk)
