<amp-ad>广告未显示

时间:2016-10-05 08:58:31

标签: amp-html

我正在尝试投放自己的AMP广告。我的代码几周前正在运行,但神秘地停止了工作。我在这里附上了一个简单的例子:

我可以从Chrome开发者工具网络标签中看出该广告已成功调用remote.html,该广告已成功获取图片。

然而,当我检查amp-ad标签本身时,它是空的 - 甚至没有空的iframe。好像它已经加载了iframe,正确地获取了所有内容,然后iframe就自行销毁了。

HELP !!!

以下是该页面的代码:

<!doctype html>
<html amp lang="en">
  <head>
    <meta charset="utf-8">
    <script async src="https://cdn.ampproject.org/v0.js"></script>
    <script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
    <title>Hello, AMPs</title>
    <link rel="canonical" href="http://dk-imac.local" />
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
    <meta name="amp-3p-iframe-src" content="https://localbtk.com/remote.html">
    <script type="application/ld+json">
      {
        "@context": "http://schema.org",
        "@type": "NewsArticle",
        "headline": "Open-source framework for publishing content",
        "datePublished": "2015-10-07T12:02:41Z",
        "image": [
          "logo.jpg"
        ]
      }
    </script>
    <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>
  </head>
  <body>
    <h1>Welcome to the mobile web</h1>
    <amp-ad width=728 height=90 type="_ping_" data-fkslot='1'>
    </amp-ad>
  </body>
</html> 

这是remote.html的代码:

<!doctype html>
<head>
<title>Remote PBL</title>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<script>
(function() {
var v = location.search.substr(1);
if (!(/^\d+(-canary)?$/.test(v))) return;
var u = 'https://3p.ampproject.net/'+encodeURIComponent(v)+'/f.js';
document.write('<script'+' src="'+encodeURI(u)+'"><'+'/script>');
})();
</script>
</head>
<body style="margin:0">
<div id="c" style="position:absolute;top:0;left:0;bottom:0;right:0;">
<script>
    // @todo Add in proper Google Analytics
    var trackJavascriptLink = function(url) {
        window.open(url, '_blank');
    };
    draw3p(function(config){    // Can add a second parameter "done" which is a function
        var x = new XMLHttpRequest();
        x.onreadystatechange = function(){
            if (this.readyState == 4 && this.status == 200) {
                document.write("<div style='width:" + (config.width - 16) + "px;height:" + (config.height - 16) + "px'>" + 
                        this.responseText + "</div>");
            }
        };
        x.open("GET", "https://localbtk.com/handler/amp-page/fetch-slot/" + config.fkslot + "/" + (config.width - 16) + "/" +
                (config.height - 16), true);
        x.send();
    },
      // List of expected amp-ad types.
      ['_ping_'],
      // List of hostnames that are allowed to embed this change.
      // Please also use ALLOW-FROM X-Frame-Options to get security in
      // browsers that do not support location.ancestorOrigins.
      ['dk-imac.local']); // My own has a few others also.
</script>
</div>
<script>if (window.docEndCallback) window.docEndCallback()</script>
</body>
</html>

2016年10月10日更新:我在AMP项目的Github页面上发布了这个问题(参见https://github.com/ampproject/amphtml/issues/5442#issuecomment-252025995)。有一个答案,但尚不令人满意,这是预期的行为,_ping_仅用于测试。但是,他们没有就我应该采取哪些不同的做法提出任何建议,这使我无法为新的广告网络创建代码&#34; (这真的只是我自己的网站)作为我唯一的选择。这将是一项很多工作,感觉真的有点过分,但这就是我现在所处的位置。

顺便说一下,这是一个例子: https://bachtrack.com/amptest.html

0 个答案:

没有答案