Support > Publisher > Distribute ads to multiple DIV containers

Distribute ads to multiple DIV containers (#2109)

(Last Update: 01.08.2017)

You can distribute the text adverts that you receive from a single client-side call to several DIV containers on your website. One or more ads can be loaded into each container. If the required advert(s) for a container do not exist, the relevant container will not be displayed (display: none). Each container can have an individual styling.

Please note that this script can only be used for text adverts.


Demo


Important instructions

  1. The initial ad code must be integrated above the fold to avoid conflicts with our visibility check.
  2. The ads must be arranged in your page layout according to their order, e.g. the first advert receives the visually best space, then the next ones follow.
    For weighting applies:
    • From top to bottom
    • From left to right
  3. The ID of the enclosing container <div id = "solads-adverts"> must not be changed.
  4. The distributed adverts will appear immediately (not only when they become visible (default behaviour)) and 1 actual impression is counted for each of them.

Sample code

<!-- SOLADS-ADVERT -->
<div id="solads-adverts">
<script type="text/javascript"  data-params="jsads">
     m3ads_system = "Solads";
     m3ads_partnernumber = 1234;
     m3ads_sectors = "1234";
     m3ads_numberadverts = 4;
     m3ads_logoimagewidth = 240;
     m3ads_logoimageheight = 120;
     solads_Acontainer = [
       [0,'solads-advert-n1','className',1],
       [1,'solads-advert-n2','className',2],
       [2,'solads-advert-n3','className',1]
     ];
     solads_Acssurl = ['cdn.solads.media/css/as/728x90.min.css',
     'cdn.solads.media/css/as/160x600.min.css'
     ];
     solads_mode = "auto";
</script>
<script type="text/javascript" src="//cdn.feed.solads.media/resources/scripts/jsAds-1.4.min.js" async></script>
<script type="text/javascript" src="//cdn.solads.media/js/jsads-distribute-1.3.min.js" defer></script>
</div>
<!-- SOLADS-ADVERT-END -->
<html>
<body>
<div id="solads-advert-n1"></div>
<div id="solads-advert-n2"></div>
<div id="solads-advert-n3"></div>
</body>
</html>

Sample Code: Manual Mode

<!-- SOLADS-ADVERT -->
<div id="solads-adverts">
<script type="text/javascript"  data-params="jsads">
m3ads_system = "Solads";
m3ads_partnernumber = 1234;
m3ads_sectors = "1234";
m3ads_numberadverts = 4;
m3ads_logoimagewidth = 240;
m3ads_logoimageheight = 120;
solads_Acssurl = ['cdn.solads.media/css/as/728x90.min.css',
'cdn.solads.media/css/as/160x600.min.css'
];
solads_mode = "manual";
</script>
<script type="text/javascript" src="//cdn.feed.solads.media/resources/scripts/jsAds-1.4.min.js" async></script>
<script type="text/javascript" src="//cdn.solads.media/js/jsads-distribute-1.3.min.js" defer></script>
</div>
<!-- SOLADS-ADVERT-END -->
<html>
<body>
<div id="solads-advert-n1"></div>
<div id="solads-advert-n2"></div>
<div id="solads-advert-n3"></div>

<button onclick="sldsFillAdverts(0,'solads-advert-n1','className',1);">Anzeigen..</button><br />
<button onclick="sldsFillAdverts(1,'solads-advert-n2','className',2);">Anzeigen..</button><br />
<button onclick="sldsFillAdverts(3,'solads-advert-n3','className',1);">Anzeigen..</button>
</body>
</html>

Functions

FunctionDetailsCall
sldsFillAdverts Triggers container to be filled with advert sldsFillAdverts (First Advert-ID for this container (starting with Zero), DIV ID, DIV CLASS, Number pf Adverts)

Callback

CustomEventExample
soladsLoaded
document.addEventListener('soladsLoaded', function (e) {
// do something
}, false);

Relevant Parameter

ParameterTypFormatDetails
m3ads_numberadverts Mandatory Integer Specify how many adverts are to be requested. This number should be the sum of the ads in the containers.
solads_Acontainer Mandatory Array [Number (continuous, starting with zero), DIV ID, DIV CLASS, Number of Adverts] Specify the details of the DIV containers that shall receive the adverts. Each container has a number (beginning with zero) in the array and a unique ID. Then define the CSS class(es) of each container and how many adverts should be assigned to it.
solads_Acssurl Optional Array (URL, URL, URL, etc.) Specify the stylesheets to be loaded for display.
solads_mode Optional String auto = Automatic advert distribution into containers that have been generated on pageload
manual = Event-triggered loading of adverts into dynamically created containers
solads_debug Optional Boolean Set value to true for the debugging mode and load the script 'jsads-distribute-1.3.debug.js'. You will then receive error messages in the console.