Ad Counting
To insert different ads when there are multiple insertions on the page, separate the ads with [ADINSERTER COUNT]
– Ad Inserter will select one ad according to the insertion counter.
This is a server-side function – it works when the plugin is called and blocks are inserted.
For example, to insert 3 different images between first four posts on homepage (if supported by the theme) you can set Automatic insertion to Between posts, set Filter to 1, 2, 3
(to limit insertion to first 3 positions) and enable insertion on Homepage and then use the following code:
<img style='height: 400px;' src="http://malsup.github.io/images/p1.jpg">
[ADINSERTER COUNT]
<img style='height: 400px;' src="http://malsup.github.io/images/p2.jpg">
[ADINSERTER COUNT]
<img style='height: 400px;' src="http://malsup.github.io/images/p3.jpg">
Ad Inserter will insert image 1 between posts 1 and 2, image 2 between posts 2 and 3 and image 3 between posts 3 and 4.
Normally the order of insertion of the codes will be the same as configured. Use [ADINSERTER COUNT="shuffle"]
for the FIRST separator only to shuffle the codes so the insertion will be randomized.
Normally the insertion of the codes stops when there are no more codes. Use [ADINSERTER COUNT="repeat"]
for the FIRST separator only to repeat the codes so the insertion will continue when there are more slots than codes.
Normally the separator is placed between codes. When the separator is above the first code, empty code (above the first separator) is not inserted. Use [ADINSERTER COUNT="empty"]
to insert empty code.
You can also combine COUNT parameters, for example [ADINSERTER COUNT="shuffle, repeat"]
.
When there are multiple insertions on the page you can use Filter (button Misc) to define which insertions are enabled.
Previous versions of the plugin used the |count|
separator for counting. This separator will continue to work.
There is a similar way to insert unique ads when the block is inserted more than once – ad rotation with unique parameter.
Options inserted with the COUNT
separator are not tracked – you’ll get statistics only for the block. In case you need to track individual options use ad rotation code with unique parameter.
Shortcodes as separators are used also for ad rotation and separation of AMP code. The order of processing separator shortcodes is the following:
[ADINSERTER COUNT]
[ADINSERTER ROTATE]
[ADINSERTER AMP]
This means that you can have AMP separator inside ROTATE options and they can be used as COUNT options.