Html 当AMP页面中没有返回广告时,如何折叠空白区域
问题发生在AMP(加速移动页面)页面中 问题: 我为我的放大器中的广告设置了广告交换。 当AdEX没有广告服务时,如何折叠空格。你能给我一个演示代码吗 我已经阅读了Github的文档,但是我仍然不知道应该在哪里调用这个函数(window.context.noContentAvailable)以及应该在哪里调用window.context.requestResize(width,height)来在没有返回广告时折叠广告位置Html 当AMP页面中没有返回广告时,如何折叠空白区域,html,google-dfp,amp-html,Html,Google Dfp,Amp Html,问题发生在AMP(加速移动页面)页面中 问题: 我为我的放大器中的广告设置了广告交换。 当AdEX没有广告服务时,如何折叠空格。你能给我一个演示代码吗 我已经阅读了Github的文档,但是我仍然不知道应该在哪里调用这个函数(window.context.noContentAvailable)以及应该在哪里调用window.context.requestResize(width,height)来在没有返回广告时折叠广告位置 <!doctype html> <html ⚡>
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body style = "background-color: green;">
<amp-ad width="300"
height="200"
type="doubleclick"
data-slot="/4119129/doesnt-exist"
style= "background-color:lightgrey;">
<div placeholder>
<!-- <iframe src ="amphtml/3p/frame.max.html"> -->
<div>
sdsd
<script type="text/javascript">
window.parent.context.onResizeSuccess(function (requestedHeight) {
console.log('success');
// body...
})
window.parent.context.onResizeDenied(function(requestedHeight){
console.log('failed');
})
window.parent.context.requestedResize(3,3);
</script>
</div>
<!-- </iframe> -->
</div>
</amp-ad>
<amp-ad width="300"
height="200"
type="doubleclick"
data-slot="/4119129/doesnt-exist"
style= "background-color:yellow;">
<div fallback>
<div>
<script type="text/javascript">
window.parent.context.onResizeSuccess(function (requestedHeight) {
console.log('success');
// body...
})
window.parent.context.onResizeDenied(function(requestedHeight){
console.log('failed');
})
window.parent.context.requestedResize(3,3);
</script>
</div>
</div>
</amp-ad>
</body>
</html>
body{-webkit动画:-amp start 8s steps(1,end)0s1 normal tweet;-moz动画:-amp start 8s steps(1,end)0s1 normal tweet;-ms动画:-amp start 8s steps(1,end)0s1 normal tweet}@-webkit关键帧-amp start{从{可见性:隐藏}到{可见性:可见}}@-moz关键帧-amp start{from{可见性:隐藏}
sdsd
window.parent.context.onResizeSuccess(函数(requestedHeight){
console.log('success');
//身体。。。
})
window.parent.context.onResizeDenied(函数(requestedHeight){
console.log('failed');
})
window.parent.context.requestedResize(3,3);
window.parent.context.onResizeSuccess(函数(requestedHeight){
console.log('success');
//身体。。。
})
window.parent.context.onResizeDenied(函数(requestedHeight){
console.log('failed');
})
window.parent.context.requestedResize(3,3);
您应该使用此处所述的回退属性:指示广告时段未填满时应发生的情况
不要尝试插入自己的Javascript。您应该使用此处描述的fallback属性:指示当广告槽未填满时应该发生什么
不要尝试插入您自己的Javascript。当没有显示时,Ads可以请求隐藏。只有在不中断用户的情况下执行此请求,AMP才会执行此请求
我知道doubleclick目前正在适当的时候发送这些请求,但我不知道其他广告网络的情况。如果有疑问,请与他们的支持人员联系。在没有任何显示的情况下,广告可以请求隐藏。AMP只会在不中断用户的情况下执行此请求
我知道doubleclick目前正在适当的时候发送这些请求,但我不知道其他广告网络的情况。如果有疑问,请与他们的支持人员联系。您可以在此处阅读有关备用占位符的信息:
(上面的GitHub链接不再有效。)
没有你的广告
您可以在此处阅读有关回退占位符的信息:(上面的GitHub链接不再有效。)
没有你的广告
请提供更多信息,说明您的解决方案为什么可以工作而不是“阅读此内容”@unbandemanchester amp ad组件会自动执行此操作,您仍然可以使用回退元素和一些自定义css覆盖此行为:请提供更多信息,说明您的解决方案为什么可以工作而不是“阅读此内容”@unbandemanchester amp ad组件会自动执行此操作,您仍然可以使用fallback元素和一些自定义css覆盖此行为: