For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

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

creativeDisplayed

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

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

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

<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 中的消息:

这有帮助吗?