Advertising rotator. The simplest banner rotator (banner scroller). Writing an ad rotator in PHP

Hello, friends. Today I want to tell you how ad rotation can be set up using the Ad Inserter plugin, and how to use separators to display various advertising codes on the site. This is one of the few plugins that I use all the time and recommend to you. With it, you can display banner ads, contextual advertising blocks and any codes, even PHP on your WordPress site.

And in addition to rich functionality, this plugin has a big advantage - code loading speed. With it, contextual advertising code loading is faster. And this is important for every site owner.

And the rotation of ad units all the more requires special attention. Here we are talking about speed and the right approach in displaying ad units. Ordinary rotators that unscrew blocks with a time interval will not work here. It is important here that only one of the ad block options is shown when the page is refreshed. That is, until you refresh the page, the ad block code will not be updated or changed. By doing so, you do not violate the rules of advertising networks.

What gives the rotation of advertising on the site

Rotation of ad units (banners) allows you to find out which ad unit works best in a particular place. Such experiments allow you to increase advertising revenue with the same level of traffic. Since they allow you to find the best format for a particular place on the site.

But you should not forget that what works well on one site does not always work well on another. It all depends on the content, site structure and traffic quality. Therefore, you should experiment on your own sites and determine the best formats and places.

How to set up rotation in Ad Inserter

It is very easy to do this. First, you decide on a place to insert an ad block, set it to display ads in this place, then the magic begins.

[ ADINSERTER ROTATE ]

Attention: remove the spaces before the brackets so that the delimiter code looks like in the screenshot below.

And after it, you need to insert the following ad block code. There is no limit on the number of delimiters.

With banners and affiliate content, you can add more than two codes. But, with contextual advertising blocks, use rotation between two blocks.

How to display different ad units between posts on the main, categories and archives

I talked about how to implement such an output through the functions.php file, and now I will show how it is much easier to do this using separators and a filter in the Ad Inserter plugin.


This is how you can easily and quickly display three different ad units, banners, images between article announcements on the main page. By checking the checkboxes of categories, tags and archives, you can easily duplicate the display of ads on these pages.

Conclusion

Now you know how you can set up ad rotation on the site. It remains the case for statistics and data analysis. In the free version of the plugin, unlike the PRO version, there is no counting of impressions and clicks. But statistics on ad units can be viewed in the ad networks' accounts, and clicks on banner links can be recorded using .

The functionality of the plugin, even in the free version, exceeds all expectations. It can only be limited by the structure of your template. And today's example shows some more great opportunities for inserting ads on the site.

Friends, that's all for today, I wish you success.

Sincerely, Maxim Zaitsev

The rotator comes from the English "rotate", which means to rotate. Hence the name of the script "rotator". Why is it needed? A clear stump for rotation, or if in our opinion, then for rotation. What to rotate? Yes, anything, banners, pictures with and without captions, text ads. etc.

For lovers of affiliate programs, this is a good opportunity to display various affiliate links, pictures, banners. Shows can be done in different ways. For example, randomly when loading each new page of the site or in turn. Or, for example, after a set time when the user views the site page.

For those who advertise their products via the Internet, the rotator will change the advertisement of the product to the next one, for example, each time the next page of the site is loaded. This can be done randomly, or you can link the advertisement of a particular product to the theme of the page you are viewing in order to resonate. Which is better is hard to say. We need statistics. Although statistics are such a thing that itself needs statistics. In my opinion randomness is the best option.

This post will focus on the simplest rotator script written in php, although it can also be created in java, but I will try to write about this in the next post. First, let's write a circular rotator, for example, for seven html files, which can be pictures, banners, text, etc. and we will try to supplement the script, for example, with a random number generator for random display of files.

So, for starters, as an example, you can use the base site rotator http: // site and do this:

It is clear that everything is quite simple. The number of the rotator is stored in a text file, each time a page of the site is opened, the number is read, increased by 1, then written back and so on until it becomes equal to the maximum set number, after which the number of the rotator returns to its original state. The name of the html pages will be 1.html, 2.html... The script can be greatly simplified if you use the random number generation function. Then it will look like this:

And finally, one more important point. Maybe someone will be useful. This is the output of an html file with advertising, which, by the way, can have any format, the same php, txt, etc., in the right place on the site page. Let's dwell on the fact that the pages of the site have the same html format. In this case, you can do this:

1. Place an environment variable of the %reklama% type in the desired container or table of the html page where you want to show the html insert with advertising;
2. Read the contents of the html file with advertising into some variable, as shown above
// Writing the contents of the html file with ads to the $rotate variable with ads
$rotate = implode("", file("$rot"));
3. Run the function to display the entire html page (for example, having the name index.html) with html advertising insert.

function html ($path)
{
global $rotate;
$page = file_get_contents($path);
$page = str_replace("%reklama%", $rotate, $down);
echo("$page");
}
html("index.html");
exit;

In the rendered index.html page, any page with an interstitial like 1.html will be rendered where %reklama% is. Ad block titles and other nonsense can be displayed in a similar way. Well, that's all. This topic can be developed in different directions, but the approximate essence is set out above. By the way, in order to better understand the essence of the above, you can test a page with a rotation script in its composition. The page is designed as a small project in Denver. The archive must be unpacked into the Denver home folder, run Denver and type rotate.ru in the browser

This idea has been brewing in my head for a long time, but I kept putting off writing a post.

I want to try crowdsourcing.

I will be brief.

Technical details - based on a framework (have not yet decided which one is better to take), most likely with a classic php + mysql connection

Architecture - 3 main levels (Site -> Page -> Blocks)

Website - name, url is set and you can add a comment

Page (or pages) - you can give a rule both to a specific page, and to some section, for example, a listing. Pages themselves are created within the framework of a site. Here you get the code that you paste on the site. By itself, inserting the code will be implemented as follows: insert the script into the template once, and then output div tags with the desired id in the right places.

Blocks - ad blocks are actually created here. So far, only 1 type of blocks "Advertising code" (Adsense or YAN) is planned at the start. For each block, you can set display conditions until there is only one choice by device - desktop or mobile. If this whole topic works, then we will gradually add new settings: GEO (both countries and large cities of Russia), display by time of day and day of the week, etc. Then you can add new types of blocks (banners, teasers etc.)

But all these wishes are still in the distant future, because it is not yet clear whether this product will be in demand or not.

According to my rough estimates, at least 40-50k rubles are needed to start, this is purely payment for the work of a programmer in order to create some kind of more or less working product.

If the minimum amount is collected, then we begin to work. Everyone who chipped in gets the product for free + updates for 1 year.

If the amount is not collected, then we close the project and forget everything. I am sending the money back.

Why is all this necessary?

As you probably know, there are not so many normal rotators on the market now, there was such a poseur, but the author abandoned it and does not plan to develop it. There is also realbig.media, but this is an online solution, besides, there are complaints about the quality and speed of work, and this is very critical.

What are the benefits of our product?

The first, and most important in my opinion, is autonomy. You do not depend on anyone, you have set yourself a non-server and use it as you want.

Second, the ability to scale, it all depends on your server settings + almost completely open source.

Third, the ability to actually influence the course of product development and add only those features that are actually needed.

Actually described quite briefly, if you have questions, write in the comments.

First of all, what is a rotator and why is it so important? Judging by the name, the term comes from the English. "rotate" - rotate. The essence of the rotator in its web incarnation is that, according to one principle or another, it rotates ads on the site.

Why do we need a rotator, you ask? Indeed, it is worth using any banner exchange network, and all problems disappear - every time it tries to substitute another banner, you just have to place the banner code. However, the reality is that in our time the return on banner systems is already minimal. More and more webmasters are switching to affiliate programs - there you choose any type of advertising, insert html code and a banner or an advertising link appears in the right place. This is where problems begin to arise. Firstly, a code that will show a new banner every time or at least rotate several different ones in a circle is an extremely rare occurrence in affiliate programs that exist today. Yes, what a rare thing there is, I know more than a hundred different affiliate programs - only three of them have a code that shows different banners every time!

But this is still half the trouble. The second point is the interests of visitors. Actually, why is it so important to show different banners, and not the same one? I think it should be clear - one visitor can easily view several pages, and maybe dozens of pages of your site. In this case, the visitor can see the banner once, go to another page, and there is the same thing, then certain services will be advertised to him by the same banner! Even if a person is interested in it, after such a visual memorization, the banner is simply ignored. If you show different banners on different topics, even the same affiliate program, the return on such advertising will be much greater.

An even better option is to display different banners for different affiliate programs. Perhaps a visitor to a site about animals is not at all interested in food for aquarium fish, but he needs cat food. Note - the difference is small, most will say that this is considered the same thing - animal feed. But practice shows that the exact correspondence of advertising to the interests of the visitor has an impact on the visitor, which reminds me of a rather interesting physical concept - resonance. In a word, by showing an ad, the theme of which accurately characterizes the interests of the visitor, you will be taken to the apple market.

So what are we going to do? No, we will not write a script-telepath that reads a person’s thoughts, not today :-). Today our task is to show as many different banners as possible to the same visitor. Yes, it is possible that the visitor will not immediately see the advertisement he is interested in. It is possible only for 3, 5.. 10 pages viewed, it will be shown to him. Some visitors will leave without seeing the ad they are interested in. However, in any case, the return will be much greater than if you put any one banner or a bunch of different ones.

Now we need to think about how to implement this script? It would be quite a good option to use Cookies - in order to avoid possible re-displays to the user of already shown banners. But I wouldn't do that. Firstly, this is an extra load, in my opinion, not justified, and, secondly, in any case, you will not use more than 2-3 affiliate programs, otherwise visitors to the resource will simply "dissolve" in a heap different affiliate programs and you won't get any use. And since it will be 2-3 programs, then most visitors will see the banners of each of them, even if they are shown in a completely random order. That is exactly what we will do.

In fact, all we need is to randomly insert one or another banner code in the right place. This is done very easily - a random number is generated from the given range and, depending on the resulting number, the corresponding code is displayed. Here is an example of such a simple php script:

Anything else you wanted? That's the whole script :-). The first two lines are used to generate a random number (more precisely, a pseudo-random number, but this is not so important) in the range from 1 to 3. Well, the third line includes the corresponding php file in the document. Accordingly, in the directory from which this script is called, there must be files 1.php, 2.php and 3.php, which contain the banner code. If you need more or less, just edit the second line of our script accordingly.

And don't let it seem to you that this script is too simple and useless. Everything is ingeniously simple. And the basic principle of rotation actually lies in the uniform random display of banners. This little script just works wonders with the return on affiliate programs, you can see for yourself.

I have been running this blog for over two years now. Mostly as an experiment and hobby. And of course I try to be useful by publishing interesting materials on a technical topic. Unfortunately, nothing in this world is free - you have to fork out for hosting every year. And I make money on it through advertising. This is what I want to talk about today.

Advertising is different. The most popular option is contextual, which you are all used to seeing on many sites. These are Yandex and Google banners. And the webmaster's earnings depend on the location of the ad units. And the more money, the more enthusiasm the blogger has and the better the project. Recently, the service for testing ad units Realbig.media has appeared.

On each site, including my blog, you can place ads in several ways: at the beginning, middle and end of the article, on the side (in the sidebar), in the header or footer of the site. But what if Google AdSense brings more money, YAN, and the site owner does not know about it? I decided to test different formats at each location on the blog to find out which ads my readers like and which ones they shouldn't.

The service is very convenient, with a beautiful design, and most importantly free. That is, all the goodies that are there at the moment are offered free of charge - a rarity in our time.

What can RealBig do?

Constant improvements lead to the fact that the information becomes irrelevant after a week. Therefore, I will talk about its capabilities for today: 12/11/2018:

  1. Testing ad blocks.
  2. Integration with partner networks.
  3. Collection and distribution of push notifications.
  4. Creation of banners and teasers.

All settings are made in your personal account. Only a plugin is installed on the site, which displays the code in real time and does not load the server with additional scripts. Management and statistics of all your projects are also available in your personal account. Different sites may work better with different ad formats, so making the same settings is not practical. Constant experimentation leads to increased profits. The income analysis is very clear and detailed.

Partner networks

In addition to Yandex and Google, there are other small companies that offer webmasters to make money on their sites. It can be manufacturers or stores of various goods. In Realbig, you can set up synchronization with the personal account of such affiliates, and the statistics of their ad impressions will also be taken into account. The most popular ones are now available: MediaVenus, Oblivki, Advertur, Medicineteaser. The list will be updated.

Banners and teasers

The first is a picture, by clicking on which you get to the advertiser's website, the second is a picture with a caption. Usually advertising companies provide ready-made materials, but if you want to advertise your product, you will have to draw a banner yourself.

The constructor is very simple and allows you to do both. The font changes, the size of the picture, the color and shape of the frame, other little things. Previously, I had to study CSS styles and HTML markup, but now I go to RealBig and do it all there with a preview. Very convenient, the output is a ready-made code that needs to be inserted as an ad block.

Pushes

A relatively new fashion trend is pop-up messages in the browser. Works on both computers and mobile devices. On my site, you may also have noticed a notification with a suggestion to subscribe. I do not send advertising through push notifications, I plan to notify about fresh publications through the RSS feed, so feel free to subscribe. Even if the blog is closed in your browser, you will understand from the pop-up that I have written a new interesting article.

  • In the sidebar there was a large block 300x600 from Yandex (settings below) and the same one from Google. The bourgeois bloc won by clicks, but the Russian bloc has more SPM. The impressions were only on the desktop. The sidebar is not displayed on mobile devices. This is 48% of all traffic.
  • Under the content, there were 3 different options: adaptive blocks of Yandex and Google and a horizontal poster of Yandex, which wins by the number of clicks. For the purity of the experiment, probably, it was necessary to put some other option for Google, but so be it.
  • In the middle of the article, 3 options were also placed: 2 Google square blocks, a vertical poster with one ad from Yandex, and a combined block with Google adaptive and Yandex motion, which won by a wide margin. There is one point here - the combined block could be considered incorrect and overestimate the results, so I went into the offices of both systems and verified the data. In Google there were 2 clicks for $0.13, and in Yandex there were 1767 impressions for 107 rubles. Visibility 25%, SPM 60r. Compared to the rest of the motion in the middle really gives more income. Overestimation is present, including due to mobile devices, on which the scrolling is often counted as a click. Therefore, the number 53 I consider wrong.
Loading...Loading...