Good day,
I'm sorry if this might be a duplicate question but most of the questions speak of Google AdSense and I've never used that.
Getting to the point, I would like to know if anyone knows how to add an advertisement from Google to an HTML 5 site.
I am doing a project. The actual site files will be on the local drive, but I would like to i.e. insert an on my page that would draw some random Google Ads and place them in this section.
I do not wish to create an advert or anything of the sort. Let's say that I have the section at a 600px by 100px block, I would like to have that "draw" any ads of a certain category to be placed there at run time.
Like I said the page itself will be local, but using internet access the page should fetch these ads.
Thank you in advance for a speedy reply, and I would like to apologize if I over explained.
First, log in to your Google AdSense account and click on the Ads tab. Next, you need to click on the Get Code button to generate the auto-ads code. AdSense will now generate a code snippet with your publisher ID and display it. You can now copy and paste this code into a text editor.
It is very easy to insert the Google Adsense in HTML just paste your code inside the body
tag and use bootstrap or CSS3 for the positioning.
<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With