Using of Asynchronous codes » Tell the ad server which ad slots in the page it manages

Tell the ad server which ad slots in the page it manages

Last modified by ZdVo on 2017/05/09 10:50
Comments (0) · Attachments (0)

As we wanted to have the actual ad slots (spaces in page where the ads are displayed) as much ad server agnostic as possible, the actual ad slots are just places telling to the browser: "hey, I am the element called 'skyscraper'" or "I am the element called 'bottom-right-ad-slot'" etc. such as here:

<div id='skyscraper'></div>
...
<div id='bottom-right-ad-slot'></div>

You can use any arbitrary naming for the IDs, but something that would help you understand the semantics of the placement would definitely help.
These elements just mark where to put ads when they arrive from the ad server. Therefore, you need to also configure how these places map to actual ad slots as defined in your ad server. This is how you do that: You can do it through manageAdSlot('ID of Element', 'position ID from Ad Server')


var sky = adserver.manageAdSlot('skyscraper', '76.1.2.1'); // also stores a reference to the created ad slot into a variable called 'sky' for later use - not required
adserver.manageAdSlot('bottom-right-ad-slot', '76.1.2.4'); // without storing a reference
...

Ad server does not understand your naming of the slots ('bottom-right-ad-slot') but it understands its own IDs ('76.1.2.4') and the tag seamlessly translates between those for you.

If you have multiple ad servers in the page, you can manage different groups of slots with a different instance of ad server. In that case, you just tell each ad server which slots are managed by it and you also provide the appropriate mapping of IDs:


adserver.manageAdSlot('skyscraper', '76.1.2.1');
adserver2.manageAdSlot('bottom-right-ad-slot', '76.1.2.4');

Note that now the skyscraper ad slot is managed by the first ad server, while bottom-right-ad-slot is managed by ad server 2. Whenever you request ads for this page now, there will be one request made to each ad server for the group of ad slots it manages. As soon as any ads arrive, they can be placed into the page. The two ad servers act completely independently and do not wait for each other.

To wrap up - you will need one manageAdSlot call for each ad slot in the page! For example 3 positions = 3x manageAdslot in webpage.

Tags:
Created by ZdVo on 2017/03/21 10:15
Translated into en by ZdVo on 2017/05/09 10:50

Navigation


This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 4.0 - Documentation