Creating a SEO friendly Random Ads Manager

ColeN
4 min readNov 16, 2024

--

Struggling to monetize blogs I’ve run over the years I’ve came to idea to display my affiliate links and promote my services as image ads a long time ago. This way could monetize a new website from day one. Not a bad idea.

Placing images with links is a no-brainer but will have to done manually or not if using a CMS and some plugin to rotate the ads. Or simply use Adsense or some other advertising network.

Neah! This doesn’t work for me!

Plugins will show only one ad unit at a time and will need a lot of visits to see any buck. If running affiliate offers maybe, just maybe if you’re lucky you can earn the same couple of dollars from just one affiliate sale.

I wanted to have full control of the ads shown on my blog, ads, images, ad placement, target links and all this have to be SEO friendly if possible.

As such a solution doesn’t exist (or I didn’t find something that meet my criteria) last option was to create it my self.

I’ve get my hands dirty and this is what I did:

  1. Made a plan and steps what the app/script should look and what should do:
    - Will need a login to access the main interface where ads can be added, set or deleted. Will need to store entered data and create ad formats that will actually display ads by randomly pull data from file where stored
    - Choose what technologies to use
    - Write the code and test it

2. PHP for the backend with javascript for the ad display and front end as plain HTML and CSS with a little use of lightweight W3CSS for faster styling. I was a bit in hurry to finish it in a day and might go back and change the styles turning into pure custom CSS without any external frameworks.

Choice was obvious and I’m not a professional coder BTW.

3. Writing the code is always the most time consuming part of web development. No exceptions, especially when a login form let everybody log-in even without correct username and password !?

Fortunately ChatGPT exist just to help you when you stuck and can’t find or think-tank the solution yourself so a login page works correctly now and validates the right username and password pair which is hardcoded for a single user.

Why just one single user? Reason is simple. Who manages your site? Certainly not more then you (and a coworker perhaps).

Next was to create the main page where the ads can be added and managed.

First was the form where you can add a new ad with all the necessary fields:
- Target URL — an affiliate link or a link to any page or website you choose
- Image URL — the absolute path of the image to be shown in the ad
- Description — this is the description of the ad, but also used as ALT tag for the images in the ad
- Display Duration (in Days). Oh the ads have expiration date if plan to sell ad space and monetize your website further this way
- And of course a submit button of a kind that process the form and store data in a JSON file while displaying the ads added to a rotation pull

Did I say ads are randomly shown? Why should randomly display ads at a first place?

This is because either way users will see the same ads/images over and over. Spicing things even more by adding a different ad format showing 4 ads in row instead of one and still not too intrusive!

This way you can show 4 ads in a single ad unit, 4 times more then a common in-article ad from most advertising networks! And, you can place this ad format exactly where you want to appear and as many times you want.

Can add as many ads as you want in your ad pool. Data will be stored in external JSON file and pulled from there randomly before expire and delete itself.

Ad formats are written in JavaScript and are fully responsive, so images will look well on every screen.

Several ad formats were premade which is enough for most purposes. Just select the ad format you want to use and a modal will show you the instructions how to implement it on your website or CMS.

Generated Ads are SEO friendly.

Target URLs have rel=”NOFOLLOW” attribute and the images have ALT tag pulled from the description you’ve entered for that ad, stored and pulled from a JSON file.

At the end a push on Logout button will log you out and clear the login credentials. This is the part I take to be the hardest!

Random Ads Manager by me is free!

Live demo is available here: https://nonconfirmed.com/demo-ads/

The full script can be get on GitHub: https://github.com/ColeNikol/Random-Ads-Manager

Hope you’ll enjoy my creation and start monetizing your website better even from day one even if you lack visitors.

--

--

ColeN
ColeN

Written by ColeN

Ordinary person sharing his experience & helping others while trying to get a piece of the pie. Problem solver at day, free thinker at night

No responses yet