跳转至

为网站添加Google广告

💾 AI智能摘要 (GLM-4)

通过Google AdSense注册账号,创建广告单元,获取代码并嵌入网站模板中,即可为网站添加Google广告,符合广告政策即可展示。

📖 阅读信息

阅读时间:1 分钟 | 中文字符:68 | 有效代码行数:14

为网站添加Google广告

  1. 登录Google AdSense并注册账号。
  2. 创建广告单元并获取广告代码。
  3. 将广告代码插入到你的网站模板中,通常是在<body>标签内。
  4. 确保你的网站符合Google的广告政策。

示例代码

<body>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2327435979273742"
     crossorigin="anonymous"></script>
<!-- AD1 -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2327435979273742"
     data-ad-slot="3702206121"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</body>

效果

image