Google Ads 试玩广告(Playable Ads)HTML 需要接入的接口规范
Google Ads 试玩广告(Playable Ads)HTML 需要接入的接口规范。
Google Ads 试玩广告(Playable Ads)的 HTML 需要接入 ExitAPI 接口来处理跳转事件。与其他平台(如 Facebook、TikTok)不同,Google Ads 不使用 mraid.js 或 FbPlayableAd,而是采用专有的 ExitAPI 机制。
核心接口:ExitAPI
必需代码
在点击 CTA(下载/安装按钮)时,必须使用 ExitApi.exit() 方法:
// CTA 按钮点击事件
document.getElementById('downloadBtn').addEventListener('click', function() {
ExitApi.exit(); // Google Ads 专用跳转接口
});
或者检查可用性后调用:
function handleCTAClick() {
if (typeof ExitApi !== 'undefined') {
ExitApi.exit();
} else {
// 兜底方案(仅在本地测试时使用)
window.open('https://play.google.com/store/apps/details?id=your.package', '_blank');
}
}HTML 必需配置
- 方向声明
必须在 HTML head 中指定试玩广告的方向:
<!-- 仅竖屏 -->
<meta name="ad.orientation" content="portrait">
<!-- 或传统方式 -->
<meta name="ad.size" content="width=320,height=480">
<!-- 仅横屏 -->
<meta name="ad.orientation" content="landscape">
<!-- 或传统方式 -->
<meta name="ad.size" content="width=480,height=320">
<!-- 同时支持横竖屏 -->
<meta name="ad.orientation" content="portrait,landscape">注意:Google Ads 要求分别上传横屏和竖屏两个版本的 ZIP 包,即使使用 portrait,landscape 设置,也需要准备两个独立的素材包 。
基础 HTML 结构模板
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="ad.orientation" content="portrait"> <meta name="ad.size" content="width=320,height=480"> <title>Playable Ad</title> <style> /* 所有样式必须内联或 base64 编码,禁止外部 CSS */ * { margin: 0; padding: 0; box-sizing: border-box; } #cta { position: absolute; bottom: 20px; width: 100%; text-align: center; } </style> </head> <body> <!-- 试玩内容区域 --> <div id="game-container"> <!-- 游戏/互动内容 --> </div> <!-- CTA 按钮 --> <button id="cta-btn">立即下载</button> <script> // 所有 JS 必须内联,禁止外部请求 document.getElementById('cta-btn').addEventListener('click', function() { if (typeof ExitApi !== 'undefined') { ExitApi.exit(); } }); </script> </body> </html>文件规范要求
项目 要求 格式 ZIP 压缩包,最大 5MB(未压缩) 文件数量 不超过 512 个文件 主文件 根目录必须包含 index.html允许格式 HTML、CSS、JS、GIF、PNG、JPG、JPEG、SVG 编码 非 ASCII 字符必须使用 UTF-8 外部请求 完全禁止 HTTP/HTTPS 请求(包括 XMLHttpRequest、fetch、外部图片/字体等) 多媒体 应用广告系列不支持声音和视频
平台对比参考
| 平台 | 跳转接口 |
|---|---|
| Google Ads | ExitApi.exit() |
FbPlayableAd.onCTAClick() | |
| TikTok/Pangle | window.openAppStore() |
| AppLovin | mraid.open() |
| IronSource | userClickedDownloadButton(event) |
| Unity Ads | mraid.open() 或 Playable API |
测试验证
上传前必须使用 Google 官方验证工具检查:
验证工具: https://h5validator.appspot.com/adwords/asset
常见错误包括:
使用 mraid.open() 而非 ExitApi.exit()
包含外部网络请求
没有正确设置方向 meta 标签
ZIP 包内文件路径错误
关键提醒:Google Ads 试玩广告不要使用 mraid.js,也不要使用 window.open() 或 location.href 进行跳转,这些都会导致审核失败