# Interstitial

{% hint style="info" %}
There are some advertisement settings in the `playgama-bridge-config.json` file

[Playgama Bridge Config](/playgama/sdk/playgama-bridge-config.md)
{% endhint %}

Interstitial ads typically appear during transitions in the game, such as level loading or after game over.

#### Is Interstitial Supported

Check if the platform supports displaying interstitial ads.

```javascript
playgama_bridge_advertisement_is_interstitial_supported()
```

#### Minimum Interval Between Displays <a href="#minimum-interval-between-displays" id="minimum-interval-between-displays"></a>

Set the minimum time interval between interstitial ad displays to comply with platform requirements and improve user experience.

```javascript
// Get delay, default value = 60 seconds
playgama_bridge_advertisement_minimum_delay_between_interstitial()

// Set new delay
playgama_bridge_advertisement_set_minimum_delay_between_interstitial(30)
```

There should be time intervals between interstitial ad displays. For convenience, this SDK includes a built-in timer mechanism between ad displays. You just need to specify the required interval, and you can call the ad display method as often as you like.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> **Interstitial State** <a href="#interstitial-state" id="interstitial-state"></a>

{% hint style="warning" %}
Check the `interstitial_state` at the start of the game, and if the ad is `opened`, perform the necessary actions (mute sounds/pause the game/etc.).
{% endhint %}

Track the state of the interstitial ad to manage ad display and user experience.

```javascript
playgama_bridge_advertisement_interstitial_state()
```

Possible values: `loading`, `opened`, `closed`, `failed`.

```javascript
// To track interstitial ad state changes, subscribe to the event

// via Async Social Event
if async_load[? "type"] == "playgama_bridge_advertisement_interstitial_state_changed" {
    switch async_load[? "data"] {
        case "loading":
            // your logic here
            break
        case "opened":
            // your logic here
            break
        case "closed":
            // your logic here
            break
        case "failed":
            // your logic here
            break
    }
}
```

{% hint style="info" %}
React to changes in ad state. For example, mute the game sound when `opened` and unmute when `closed` and `failed`.
{% endhint %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> **Show Interstitial** <a href="#show-interstitial" id="show-interstitial"></a>

Display an interstitial ad at appropriate moments, such as during level transitions or game over screens.

```javascript
var placement = "test_placement" // optional
playgama_bridge_advertisement_show_interstitial(placement)
```

{% hint style="warning" %}
Do not call `show_interstitial()` method at the start of the game. On platforms where this is allowed, the ad will be shown automatically.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://wiki.playgama.com/playgama/sdk/engines/gamemaker/advertising/interstitial.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
