Amp html iframe内<;amp ad>;标记未调整大小

Amp html iframe内<;amp ad>;标记未调整大小,amp-html,double-click,google-dfp,google-ad-manager,amp-ad,Amp Html,Double Click,Google Dfp,Google Ad Manager,Amp Ad,我们正在尝试动态调整“amp ad”的大小,但包含广告的iframe显示为1x1,而不是300x250 我们确实使用“amp广告”和“通用”创意(设置尺寸为1x1,如本文所述),但尽管amp广告的高度和宽度为“300x250”,但广告以1x1呈现 <!doctype html> <html ⚡ lang="en"> <head> <meta charset="utf-8"> <title>AMP Ads</title>

我们正在尝试动态调整“amp ad”的大小,但包含广告的iframe显示为1x1,而不是300x250

我们确实使用“amp广告”和“通用”创意(设置尺寸为1x1,如本文所述),但尽管amp广告的高度和宽度为“300x250”,但广告以1x1呈现

<!doctype html>
<html ⚡ lang="en">
<head>
  <meta charset="utf-8">
  <title>AMP Ads</title>
  <link rel="canonical" href="https://www.toto.com/solar.html"/>
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
  <script async src="https://cdn.ampproject.org/v0.js"></script>
  <script  custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-latest.js"></script>
  <script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-latest.js"></script>
  <script async custom-element="amp-sticky-ad" src="https://cdn.ampproject.org/v0/amp-sticky-ad-latest.js"></script>
  <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
</head>
<body style="padding:10px">


     <amp-ad width="300" height="250"
              type="doubleclick"
              data-slot="my-data-slot"
              rtc-config='{
  "vendors": {
  "my-vendor": {"additional-infos":"111"}
  }, "timeoutMillis": 999}'
              json='{"targeting":{"test": "test"}}'
      >
        <div placeholder><div style="text-align: center; font-size: smaller; color: gray;">No ads for the moment....</div></div>
      </amp-ad>


<amp-sticky-ad layout="nodisplay">
  <amp-ad width="320" height="50"
          type="doubleclick"
              data-slot="my-data-slot"
              rtc-config='{
  "vendors": {
  "my-vendor": {"additional-infos":"111"}
  }, "timeoutMillis": 999}'
          json='{"targeting":{"test": "test"}}'
  >
    <div placeholder><div style="text-align: center; font-size: smaller; color: gray;">No ads for the moment....</div></div>
  </amp-ad>
</amp-sticky-ad>

检查您是否没有在安全框架中运行creatives,尝试将其关闭


此外,您可能应该参考
window.parent.context.requestResize
,而不是
window.context.requestResize
,据我所知,DFP只在iframe中呈现creatives—您的代码在那里运行,而该框架没有
window.context
。但是,它的父帧应该有它,因为它是实际的amp ad帧。

如果您没有在安全帧中运行creatives,请尝试将其关闭

此外,您可能应该参考
window.parent.context.requestResize
,而不是
window.context.requestResize
,据我所知,DFP只在iframe中呈现creatives—您的代码在那里运行,而该框架没有
window.context
。但是,它的父帧应该有它,因为它是实际的amp ad帧

  window.parent.postMessage({
    sentinel: 'amp',
    type: 'embed-size',
    width: 300,
    height: 250}, '*');