You can do it as you like, from a technical point of view. The world of online advertising is very, very wide, and there is a lot of variety. However, the hardest part is the advertisers. Without people paying for you to advertise their products / services, this will not help you.
I would suggest registering for an account with an advertising company such as Google AdSense . They will take care of matching advertisers with web properties, and itās very simple to provide the necessary hooks. They have everything that is well documented and very easy to get up and work. Iām sure that the AdSense registration process even allows you to do what you need to do, which is as simple as adding extra HTML to your pages.
Trying to find your advertisers and implement your own solution will simply be a big waste of time in most cases, because the market is so saturated with many of the best options for advertisers to use.
In the end, the best way to get information on how to integrate with the ad network is to simply contact them and ask. Most reputable ones already have good documentation on how to place your ads on your site.
In general, ad networks basically use the fact that you add HTML to your page, which links to a resource through a URL (often with your account number or similar identifier) āāon the server that controls the ad network. A resource can be an image, video, a piece of JavaScript, or something else (iFrame is another common one).
In most cases, it will be a fragment of JavaScript or iFrame, and the script will display ads on its network and install it inside the link. This link, as a rule, is a link to your server, which then redirects the user by clicking on any destination in which traffic is advertised.
By clicking on a resource on their server, they count the number of āimpressionsā or āviewsā that a certain part of the ad received from your site, and by routing the click through their server, they count the number of clicks . Since you send them your account identifier when you request a resource, they can associate all this with your account, and pay you based on ācost-per-clickā (CCP) and / or impressions .
Other examples of custom ads (for example, somewhere in a banner) include ad networks that use a script to scan the text content of your pages and selectively translate certain words into links, often with larger ads that appear when a user mouse passes through them. A variant of this is ads that appear when you first enter a site, or those that āattachā to usersās cursor for a certain amount of time.
All of these examples, however, are quite invasive, and are likely to spoil your users and reduce the number of users that you have on your site , which is BAD THING . Google has done a lot and a lot of research on how to effectively advertise, including things like size, color, differentiation from the rest of the siteās content, etc. And they make most of this information available in the AdSense documentation.