> 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 interstitial ad to the user. `loadFullScreenAd`the same as used in `adGroupId`must be passed. Since ads that have already been displayed cannot be shown again, you must load a new one after the ad is closed.

Toss app `5.227.0` Can be used on versions above (`5.239.0` Above is Toss Ad + AdMob integration, below is AdMob only). Before calling `showFullScreenAd.isSupported()`You can check support 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 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 that releases the app bridge callback (`() => void`) to release resources.

### Error

If ad display fails, `failedToShow` event or `onError` passed as a callback. Reward ads `userEarnedReward` You should grant the reward only 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 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/showfullscreenad.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.
