-1
我为AD服务平台工作,使用CDN服务来投放广告。我们只能将静态文件上传到CDN。如果我们想要服务Adsense或其他广告JS片段,例如。如下所示:如何在另一个JS文件中调用AdSense代码?
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- site 180x150 -->
<ins class="adsbygoogle"
style="display:inline-block;width:180px;height:150px"
data-ad-client="ca-pub-xxxx"
data-ad-slot="xxxx"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
创建JS文件并将其上传到CDN不起作用。代码不会被调用。我曾尝试将代码重写为document.write(),但它也不起作用。
任何想法?