> 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/showfullscreenad.md).

# showFullScreenAd

### Feature description

`loadFullScreenAd`Show the preloaded integrated full-screen ad to the user. `loadFullScreenAd`the same as used in `adGroupId`You must pass it. Since an ad that has already been displayed cannot be displayed again, you need to load a new one after the ad is closed.

Toss app `5.227.0` Can be used on versions above (`5.239.0` For versions above, Toss Ad + AdMob integration; for versions below, AdMob only). Before calling `showFullScreenAd.isSupported()`You can check whether it is supported with

### Type

```ts
showFullScreenAd(params: ShowFullScreenAdParams): () => void;
```

**Params**

```ts
type ShowFullScreenAdParams = {
  options: ShowFullScreenAdOptions;
  onEvent: (event: ShowFullScreenAdEvent) => void;
  onError: (error: unknown) => void;
};

type ShowFullScreenAdOptions = {
  /** The ad group ID is the same as the one used in loadFullScreenAd. */
  adGroupId: string;
};

type ShowFullScreenAdEvent =
  | { type: "requested" }
  | { type: "show" }
  | { type: "impression" }
  | { type: "clicked" }
  | { type: "dismissed" }
  | { type: "failedToShow" }
  | {
      type: "userEarnedReward";
      data: { unitType: string; unitAmount: number };
    };
```

Event `type` Value:

| type               | Description                                                              |
| ------------------ | ------------------------------------------------------------------------ |
| `requested`        | The request to show the ad succeeded                                     |
| `show`             | The ad was displayed on screen                                           |
| `impression`       | The ad impression was recorded (the point at which revenue is generated) |
| `clicked`          | The user clicked the ad                                                  |
| `dismissed`        | The user closed the ad                                                   |
| `failedToShow`     | Failed to show the ad                                                    |
| `userEarnedReward` | The user earned a reward (reward ads only)                               |

**Response**

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

### Error

If showing the ad fails `failedToShow` event or `onError` It is delivered via callback. Reward ads `userEarnedReward` should only award a reward when the event occurs.

### Example code

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

const AD_GROUP_ID = "AD_GROUP_ID";
const button = document.querySelector("#show-full-screen-ad");

button.addEventListener("click", () => {
  const cleanup = showFullScreenAd({
    options: { adGroupId: AD_GROUP_ID },
    onEvent: (event) => {
      switch (event.type) {
        case "impression":
          console.log("Ad impression recorded (revenue generated)");
          break;
        case "userEarnedReward":
          console.log(
            "Reward earned:",
            event.data.unitType,
            event.data.unitAmount,
          );
          break;
        case "dismissed":
          console.log("The ad has been closed. Load the next ad again.");
          cleanup();
          break;
        case "failedToShow":
          console.error("Failed to show the ad.");
          cleanup();
          break;
      }
    },
    onError: (error) => {
      console.error(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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
