美好的一天,
对不起,如果这可能是一个重复的问题,但大多数问题都与Google AdSense有关,而且我从未使用过。
说实话,我想知道是否有人知道如何将Google的广告添加到HTML 5网站。
我正在做一个项目。实际的站点文件将位于本地驱动器上,但我想在我的页面上插入一个可以绘制一些随机Google广告并将其放入此部分的内容。
我不想创建广告或任何类型的广告。让我们说我有一个600px乘100px块的部分,我想有那个"画"任何类别的广告都会在运行时放置在那里。
就像我说的那样,页面本身就是本地的,但是使用互联网访问页面应该可以获取这些广告。
提前感谢您的快速回复,如果我解释过,我想道歉。
答案 0 :(得分:2)
在HTML中插入Google Adsense非常容易,只需将代码粘贴到body
标记内,然后使用bootstrap或CSS3进行定位。
<html>
<head>
This is the head of your page
<title>Example HTML page</title>
</head>
<body>
**Paste your google adsense code inside the body**
This is the body of your page.
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Homepage Leaderboard -->
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-1234567890123456"
data-ad-slot="1234567890"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</body>
</html>
答案 1 :(得分:0)
参考Get and copy the ad code(点击&#34;如果您尚未在&#34下创建广告单元;如何获取并复制广告代码&#34;)
然后参考Where to paste the ad code in your HTML
很好地解释了
答案 2 :(得分:0)
<html>
<head>
This is the head of your page
<title>Example HTML page</title>
</head>
<body>
This is the body of your page.
<!-- Ad block -->
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-1234567890123456"
data-ad-slot="1234567890"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<!-- End of Ad block -->
</body>
</html>
答案 3 :(得分:0)
无法从本地主机或已保存的 html 文件加载 Adsense。不起作用。 在展示广告之前,Google 会检查该域是否被 adsense 接受。 因此,当您从本地加载广告时,域属性将丢失。