> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/sdk/domains-api/ads/loadfullscreenad.md).

# loadFullScreenAd

### Feature description

Preload an integrated full-screen ad. Toss Ad is shown first, and in environments where it can't be used, it automatically switches to AdMob so you can serve ads reliably. You must call this before displaying the ad.

It behaves differently depending on the Toss app version:

| Toss app version                       | Supported features                                                                           |
| -------------------------------------- | -------------------------------------------------------------------------------------------- |
| `5.239.0` and above                    | Toss Ad + AdMob integration (Toss Ad first, automatically switches to AdMob if not possible) |
| `5.227.0` and above \~ `5.239.0` below | Show only AdMob ads                                                                          |
| `5.227.0` below                        | Not supported                                                                                |

Before calling `loadFullScreenAd.isSupported()`You can check whether it is supported with

### Type

```ts
loadFullScreenAd(params: LoadFullScreenAdParams): () => void;
```

**Params**

```ts
type LoadFullScreenAdParams = {
  options: LoadFullScreenAdOptions;
  onEvent: (event: LoadFullScreenAdEvent) => void;
  onError: (error: unknown) => void;
};

type LoadFullScreenAdOptions = {
  /** This is the ad group ID. Please enter the value issued from the Apps in Toss console. */
  adGroupId: string;
};

type LoadFullScreenAdEvent = {
  type: "loaded";
};
```

**Response**

Function to unregister the AppBridge callback (`() => void`).

### Error

If ad loading fails, `onError` An error is delivered via the callback. If you call it on an unsupported version, `onError`an error is delivered, so before calling `isSupported()`check with

### Example code

```js
import { Ads } from "@apps-in-toss/web-framework";

let isAdLoaded = false;

function prepareAd() {
  if (!loadFullScreenAd.isSupported()) {
    console.warn("Full-screen ads are not available in the current environment.");
    return;
  }

  const cleanup = loadFullScreenAd({
    options: { adGroupId: "AD_GROUP_ID" },
    onEvent: (event) => {
      if (event.type === "loaded") {
        console.log("Ad load complete");
        isAdLoaded = true;
        cleanup();
      }
    },
    onError: (error) => {
      console.error("Ad load failed:", error);
      cleanup();
    },
  });
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/sdk/domains-api/ads/loadfullscreenad.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
