> 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/publishers/zh/zhan-dian-yu-guang-gao-wei/dfi-mfi-html-events.md).

# 为全屏插页广告添加 HTML 事件

该 **桌面端全页插页广告** 和 **移动端全页插页广告** 广告格式可以通过某些 HTML 事件与你的网站交互。你可以监听这些事件，在你的网站中触发额外操作。

## creativeDisplayed

当 Fullpage Interstitial 广告加载到用户的浏览器中时，它会生成事件 `creativeDisplayed-XXXXXXX`，其中 `XXXXXXX` 是对应该 Fullpage Interstitial 广告位的 zone id。

此事件监听器允许你以编程方式在网站上执行所需的任何操作，并获取触发该事件的元素的更多信息，例如 URL、id、classes 和 text。

在下面的示例中，我们正在显示 `Creative 已显示！` 当 Fullpage Interstitial 显示时，Console 中的消息，并且我们列出了触发该事件的元素的所有详细信息：

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

<a href="https://www.exoclick.com">访问 exoclick.com！</a>

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

## 消息

如果你的 Fullpage Interstitial 广告位投放的是 iframe 广告系列，那么你可以为事件添加一个事件监听器 `消息`。这允许你在 iframe 加载到用户浏览器后，以编程方式执行网站上所需的任何操作。

事件数据包含属性 `id`，它是 iframe url 参数的 md5 哈希，以及 `loaded` 为 true。在下面的示例中，我们正在显示 `Iframe 已加载！` 当 Iframe 显示给用户浏览器时，Console 中的消息：

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

<a href="https://www.exoclick.com">访问 exoclick.com！</a>

<script type="application/javascript">
    window.addEventListener('message', function(event) {
        if (event.data.id && event.data.loaded) {
            console.log("Iframe 已加载！")
        }
    });
</script>
```


---

# 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/publishers/zh/zhan-dian-yu-guang-gao-wei/dfi-mfi-html-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.
