# Interstitial

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

[playgama-bridge-config](https://wiki.playgama.com/playgama/sdk/playgama-bridge-config "mention")
{% 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.

```gdscript
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.

```gdscript
Bridge.advertisement.minimum_delay_between_interstitial
```

To change the interval:

```gdscript
# Default value = 60
Bridge.advertisement.set_minimum_delay_between_interstitial(30)
```

#### <img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F9BooaofCI33U9Np5oeif%2FFrame%203%20(1).png?alt=media&#x26;token=0750b56a-a069-4759-bda9-29951f06cd30" 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 (loading, opened, closed, failed) to manage ad display and user experience.

```gdscript
Bridge.advertisement.interstitial_state
```

Returns the current state of the interstitial ad. Possible values: `loading`, `opened`, `closed`, `failed`.

{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
# To track interstitial state changes, connect to the signal
func _ready():
    Bridge.advertisement.connect("interstitial_state_changed", self, "_on_interstitial_state_changed")

func _on_interstitial_state_changed(state):
    print(state)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
# To track interstitial state changes, connect to the signal
func _ready():
    Bridge.advertisement.connect("interstitial_state_changed", Callable(self, "_on_interstitial_state_changed"))

func _on_interstitial_state_changed(state):
    print(state)
```

{% endtab %}
{% endtabs %}

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

#### <img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F9BooaofCI33U9Np5oeif%2FFrame%203%20(1).png?alt=media&#x26;token=0750b56a-a069-4759-bda9-29951f06cd30" alt="" data-size="line"> Show Interstitial Ad <a href="#show-interstitial-a-d" id="show-interstitial-a-d"></a>

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

```gdscript
var placement = "test_placement" # optional
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 %}
