> 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/fr/campagnes/iframe-events.md).

# Événements Iframe

Les annonceurs peuvent suivre les événements dans leurs publicités. Ces événements sont gérés par programmation directement dans le navigateur du client à l'aide de JavaScript.

## Événements

### creativeDisplayed

{% hint style="info" %}
Ceci est disponible uniquement pour **Interstitiel pleine page sur ordinateur** et **Interstitiel pleine page mobile** (*DFPI/MFPI*) campagnes de format publicitaire avec **URL de l'iframe** variation.
{% endhint %}

Lorsque la publicité est affichée à l'utilisateur, un message est envoyé dans l'iframe appelé `creativeDisplayed`.

Vous pouvez suivre cet événement dans votre iframe en utilisant le script ci-dessous, qui ajoute un écouteur d'événements pour intercepter le message envoyé une fois la publicité affichée à l'utilisateur.

```html
<script>
        function readMessage(event) {
            console.log("événement readMessage");
            console.log("origine : " + event.origin);
            console.log("données : " + event.data);
        }

        if (window.addEventListener) {
            // Pour les navigateurs Web conformes aux standards
            window.addEventListener("message", readMessage, false);
        } else {
            window.attachEvent("onmessage", readMessage);
        }
</script>
```

## Exemple - Interstitiel pleine page

```html
<!DOCTYPE html>
<html>
<head>
    <!-- PARTIE ÉVÉNEMENT -->
    <script>
        function readMessage(event) {
            console.log("événement readMessage");
            console.log("origine : " + event.origin);
            console.log("données : " + event.data);
            var message = "Nous avons reçu le message : '" + event.data + "' de '" + event.origin + "' (nous sommes maintenant sur l'iframe de l'annonceur)";
            console.log(message);
            document.getElementById("received-message").innerHTML = message;
            // l'annonceur souhaite mettre à jour un élément
        }
        if (window.addEventListener) {
            // Pour les navigateurs Web conformes aux standards
            window.addEventListener("message", readMessage, false);
        } else {
            window.attachEvent("onmessage", readMessage);
        }
    </script>
    <!-- FIN DE LA PARTIE ÉVÉNEMENT -->
</head>
<body>
    <h1>Mon en-tête de test pour l'iframe</h1>
    <p>Mon paragraphe de test pour l'iframe</p>
    <p id="received-message">En attente du message</p>
</body>
</html>
```

<figure><img src="https://3382703542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi4Is92LUeIhwL8XSbGLq%2Fuploads%2Fi5JLh6QPqPkUvOLOHp8C%2Fexoclick_interstitial_iframe_creativeDisplayed.gif?alt=media&amp;token=d6f5f9a9-5944-4365-a1eb-3e6bfdca2520" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.exoclick.com/advertisers/fr/campagnes/iframe-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.
