> For the complete documentation index, see [llms.txt](https://docs.exoclick.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.exoclick.com/advertisers/it/campagne/iframe-events.md).

# Eventi iframe

Gli inserzionisti possono tracciare gli eventi nei loro annunci. Questi eventi sono gestiti a livello programmatico direttamente nel browser del client con l'aiuto di JavaScript.

## Eventi

### creativeDisplayed

{% hint style="info" %}
Questo è disponibile solo per **Interstitial fullpage desktop** e **Interstitial fullpage mobile** (*DFPI/MFPI*) campagne di formati annuncio con **URL dell'iframe** variazione.
{% endhint %}

Quando l'annuncio viene mostrato all'utente, viene inviato un messaggio all'iframe chiamato `creativeDisplayed`.

Puoi tracciare questo evento all'interno del tuo iframe usando lo script qui sotto, che aggiunge un ascoltatore di eventi per intercettare il messaggio inviato una volta che l'annuncio viene mostrato all'utente.

```html
<script>
        function readMessage(event) {
            console.log("evento readMessage");
            console.log("origine: " + event.origin);
            console.log("dati: " + event.data);
        }

        if (window.addEventListener) {
            // Per browser web conformi agli standard
            window.addEventListener("message", readMessage, false);
        } else {
            window.attachEvent("onmessage", readMessage);
        }
</script>
```

## Esempio - Interstitial fullpage

```html
<!DOCTYPE html>
<html>
<head>
    <!-- PARTE EVENTO -->
    <script>
        function readMessage(event) {
            console.log("evento readMessage");
            console.log("origine: " + event.origin);
            console.log("dati: " + event.data);
            var message = "Abbiamo ricevuto il messaggio: '" + event.data + "' da '" + event.origin + "' (ora siamo nell'iframe dell'inserzionista)";
            console.log(message);
            document.getElementById("received-message").innerHTML = message;
            // ad esempio l'inserzionista vuole aggiornare qualche elemento
        }
        if (window.addEventListener) {
            // Per browser web conformi agli standard
            window.addEventListener("message", readMessage, false);
        } else {
            window.attachEvent("onmessage", readMessage);
        }
    </script>
    <!-- FINE DELLA PARTE EVENTO -->
</head>
<body>
    <h1>Intestazione del mio iframe di prova</h1>
    <p>Paragrafo del mio iframe di prova</p>
    <p id="received-message">In attesa del messaggio</p>
</body>
</html>
```

<figure><img src="/files/53c8fa43ad5732320e6d4e47c343f75271e3464c" alt=""><figcaption></figcaption></figure>


---

# 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://docs.exoclick.com/advertisers/it/campagne/iframe-events.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.
