> For the complete documentation index, see [llms.txt](https://docs.exads.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.exads.com/publishers/sites-and-zones/dfi-mfi-html-events.md).

# Adding HTML Events for Fullpage Interstitials

As a Publisher, you can make the **Desktop Fullpage Interstitial** and **Mobile Fullpage Interstitial** ad formats interact with your website through HTML events. Use these events to trigger additional actions on your website.

## creativeDisplayed Event <a href="#creativedisplayed" id="creativedisplayed"></a>

When a Fullpage Interstitial ad is loaded in the user's browser, it generates the event `creativeDisplayed-XXXXXXX`, where `XXXXXXX` is the zone id corresponding to that Fullpage Interstitial ad zone.

This event listener allows you to programmatically execute any action you may need on your website and get more information about the element that triggered the event, such as the URL, id, classes and text.

The example below displays the `Creative shown!` message in the console when the Fullpage Interstitial is shown, and lists all the details from the element that triggered the event:

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://a.example.com/ad-provider.js"></script> 
 <ins class="abcde12345" data-zoneid="1234567"></ins> 
 <script>(AdProvider = window.AdProvider || []).push({"serve": {}});</script>

<a href="https://www.example.com">Visit example.com!</a>

<script type="application/javascript">
    document.addEventListener('creativeDisplayed-1234567', function (e) {
        console.log("Creative shown!");
        console.log(e.detail);
    }, false);
</script>
```

{% endcode %}

## message Event <a href="#message" id="message"></a>

If your Fullpage Interstitial ad zone serves an iframe campaign, then you can add an event listener to the event `message`. This allows you to programmatically execute any action you may need on your website after the iframe is loaded in the user's browser.

The event data contains the properties `id`, which is an md5 of the iframe URL parameter, and `loaded` being true. The example below displays the `Iframe loaded!` message in the console when the iframe is shown in your visitor's browser:

{% code overflow="wrap" expandable="true" %}

```html
<script async type="application/javascript" src="https://a.example.com/ad-provider.js"></script> 
 <ins class="abcde12345" data-zoneid="1234567"></ins> 
 <script>(AdProvider = window.AdProvider || []).push({"serve": {}});</script>

<a href="https://www.example.com">Visit example.com!</a>

<script type="application/javascript">
    window.addEventListener('message', function(event) {
        // Only accept messages from the network's ad-serving domain
        if (event.origin !== "https://s.<network-domain>") return;
        if (event.data.id && event.data.loaded) {
            console.log("Iframe loaded!")
        }
    });
</script>
```

{% endcode %}


---

# 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://docs.exads.com/publishers/sites-and-zones/dfi-mfi-html-events.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.
