我的网站右侧栏中有2个(300x250)Adsense广告单元
我使网站响应迅速,并将这些广告单元替换为Adsense响应式广告单元 .
我现在的问题是,Adsense现在提供2 x(300x600)广告单元 . Adsense TOS声明您每页只能投放1(300x600)个广告单元
最大宽度显然会被adsense响应式广告单元所吸引 .
但是,当我尝试将父div的最大高度设置为250px时,为了限制每页300x600的广告数量,最大高度会被忽略,而adsense仍会显示300x600
是否有其他人遇到此问题,如果是,您是如何设置响应广告单元的最大高度的?
提前致谢,
凯斯
4 回答
您可以将
data-ad-format="auto"
更改为data-ad-format="rectangle"
. (请参阅高级功能> Horizontal shape example . )我认为你应该 not 在父
div
上定义height
(max-height
) .广告高度(自动)由
adsbygoogle.js
(即 smart 大小调整)确定,如果您想控制广告高度,则需要使用data-ad-format
("rectangle","vertical","horizontal"或preferred combination,如"rectangle,horizontal") .或者(不推荐)您可以"downgrade"广告代码(通过删除
data-ad-format
属性)然后使用@media
查询指定 exact 尺寸 . (见Exact size example . )EDIT - Google在“About responsive ad units”页面上更新了"Technical considerations"部分 .
我刚刚设法解决了这个问题 - 您可以为数据广告格式设置逗号分隔列表 .
data-ad-format =“矩形,水平”
如果您已将媒体查询设置为特定尺寸,则会将移动广告设置为水平,将桌面设置为矩形 .
谢谢,Wesiwyg
您可以在
<ins style="display:inline-block;......">
中使用CSS或指定类<ins class="adsbygoogle ......">
来实现示例 from Google AdSense answers: Specify an expandable width and a fixed height
来自Policies and restrictions:
要完成此操作,请先将广告容器或广告代码设置为中心 . 使用此标签:
<center>Adsense code here</center>
. 然后设置最大高度或宽度以及最小高度或宽度,就像我在下面的示例中所做的那样 .