减少初始加载时间 - google 网页设计师

Reduce initial load time - google web designer

我们正在使用 google 网页设计器工具制作一些广告

到目前为止还不错,但一个主要问题是加载速度慢。

加载需要将近 3 秒,我们对此感到非常遗憾。

谁知道怎么优化?

谢谢。

@cnu - 我遇到过同样的问题。我目前唯一的解决方法是设置初始 loading 图片 - 在广告加载时

尝试在开始的正文标签后立即添加 ID 为 'loading' 的 div。

 <div id="loading" class="loading-image">
     <img src="default.png"/>
    </div>

然后找到下面的函数,将div设置为屏蔽显示

function handleDomContentLoaded(event) {
        // This is a good place to show a loading or branding image while
        // the ad loads.
        document.getElementById('loading').style.display = 'block';
      }

然后找到下面的函数,将div设置为none——加载后隐藏图片

function handleAdInitialized(event) {
        // This marks the end of the polite load phase of the Ad. If a
        // loading image was shown to the user, this is a good place to
        // remove it.
        document.getElementById('loading').style.display = 'none';
      }

官方的GWD指令与源中实际生成的函数不匹配,这最初让这个设置变得混乱。源代码中的代码注释表明这些是要使用的正确函数。您可以使用广告的第一帧作为加载图像,而不是加载 gif - 这样用户体验不会受到太大影响。

希望这对您有所帮助。

在开发 html5 横幅时,默认选中 'polite load'。

这意味着您的横幅将不可见,并且在页面加载之前不会加载。

并且在测试您的横幅广告时,在显示横幅广告之前会有一些时间来模拟网页加载。

为什么?

因为没有出版商(网站)允许你让他们的网站变慢。这是规则。您无法强迫自己首先出现在发布商网站上。

如果你想要这个选项。您应该直接与发布商联系/获得他们的批准后,您可以在发布广告时取消选中 'Polite Load'。然后您的横幅将显示得更快,没有任何延迟。