How and where to place advertising snippets on a website

; Date: June 23, 2016

Tags: Website Advertising

It is simple to place HTML snippets from Google Adsense or other advertising services on a website. The advertising providers tend to tell you to simply paste the HTML snippet into the site template. But as easy as that is, it is not always obvious how to do this. How do I place AdSense ad on my HTML page? Lets take a look.

As a prerequisite you will need to sign up for an advertising service like Google's Adsense.

The advertising services will give instructions for integrating their service onto your website. In some cases you might need to insert two code snippets, one to enable the advertising service in the first place, and the second to mark each place for advertising.

Once you've integrated the advertising service into your website, you can go about creating "ad units". An ad unit is an advertising block that the advertising service will fill with advertising. The idea is of course to display ad units on your website, and the advertising service pays you for revenue earned from the advertising real estate you make available.

Inserting code snippets

The phrase insert code snippets is a key competency you will need to develop. Let's go over this first.

The advertising partner might give a code snippet like so:

<script src="//advertising-partner.com/ads" 
        data-client-id="9x92938" 
        data-unit-id="8z8z8z8z8"></script>

You'll be told a location to insert the code. For example sometimes code is places at the bottom of the HTML just above the closing </BODY> tag. In other cases you'll need to place the code in the location where the advertising is to be shown.

The core capability is being able to modify the HTML templates used to build your site.

This task is going to vary based on website technology you're using. Therefore we cannot accurately guide you in what to do. We can only give generalized advice.

You'll be looking for words like "templates" or "widgets" in the administrative area of the website. In some cases you'll be able to install a "plugin" to handle the advertising code.

The point is - the advertising service will give you a little block of HTML code - and you'll then either create a "widget" or edit the templates or use an appropriate plugin to enter that HTML snippet into your website.

Where to place advertisements

This is where you learn something about yourself. How much advertising do you end up running on your site? How blaring will the advertising be? Do you stick it directly in front of your visitors face? Do you use overlay adverts? Or popunders?

Commonly web publishing platforms support "sidebars" that will contain "blocks" or "widgets". A simple thing is to add advertising to the sidebar.

But of course the viewers eye often skips over the sidebar, and they'll instead be reading the content, and therefore advertising in the middle of the content might do better than advertising in a sidebar.

But it's a slippery slope. There are services with advertising of questionable repute - that send viewers into clickbait traps. Do you want your site known for sending your visitors to such places?

It's my belief that the visitors deserve respect. You do want those visitors to come back in the future, yes? Or do you want to piss off the viewers while earning the most immediate revenue? I believe it's better to give respect, to aim for a future reward from loyal visitors.

That means the services that blare at visitors with video, or expand just because the user moused over the ad, or throw popups or popunders ... all that does not treat the visitor with respect. It is respectful to tastefully insert advertising blocks into the middle of content, and to do so in sidebars.

About the Author(s)

David Herron : David Herron is a writer and software engineer focusing on the wise use of technology. He is especially interested in clean energy technologies like solar power, wind power, and electric cars. David worked for nearly 30 years in Silicon Valley on software ranging from electronic mail systems, to video streaming, to the Java programming language, and has published several books on Node.js programming and electric vehicles.