华纳云香港服务器

如何在百度MIP页面添加谷歌Adsense广告?

谷歌 Adsense 广告在 PC 端网页添加还是比较简单的,在AMP 页面添加的话可以参考《WordPress 站点 AMP 页面如何添加谷歌广告联盟代码?》,今天我们就来看看如何在百度 MIP页面添加谷歌 Adsense 广告。

百度 MIP 页面添加谷歌 Adsense 广告步骤

1.引用 mip-adsense.js 组件脚本

  1. <!–引入 mip-adsense.js–>
  2. <script src=“https://c.mipcdn.com/static/v1/mip-adsense/mip-adsense.js”></script>

提示:MIP 的所有组件都是基于 mip.js 环境运行,所以引入的脚本必须放在 mip.js 脚本后。

2.页面合适的位置添加广告代码

Google Adsense 原版代码示例:

  1. <script type=“text/javascript”>
  2.     google_ad_client = “ca-pub-4413237575816591”;
  3.     google_ad_slot = “9862911456”;
  4.     google_ad_width = 300;
  5.     google_ad_height = 250;
  6. </script>
  7. <script type=“text/javascript” src=“//pagead2.googlesyndication.com/pagead/show_ads.js”></script>

Google Adsense MIP 版代码示例:

  1. <mip-adsense ad-client=“ca-pub-4413237575816591” ad-slot=“9862911456” ad-format=“auto”></mip-adsense>

上面的为 Google Adsense 原版的广告代码,切记是不能够直接放置在页面中的,而是通过获取原版代码中的两个参数对应填写在 MIP 版代码中对应的位置。

代码属性说明

  • ad-client 说明:用户;必选项:是;类型:字符串
  • ad-slot 说明:位置;必选项:是;类型:字符串
  • ad-format 说明:格式;必选项:否;类型:字符串
  • ad-width 说明:宽度;必选项:否;类型:字符串
  • ad-height 说明:高度;必选项:否;类型:字符串

以上内容整理自@泪雪博客

本文地址:https://boke112.com/post/5459.html

赞 (0) 打赏
版权声明:本文为原创文章,版权归 boke112百科 所有,欢迎分享本文,转载请保留出处!发布此文是出于传递更多信息之目的,若有来源标注错误或侵犯了您的合法权益,请联系我们,确认后马上更正或删除,谢谢!
wu