Using of Asynchronous codes » Include the tag engine

Include the tag engine

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

The first prerequisite for the tags to function is to include the "tag engine" into the page.  The tag engine is the piece of JavaScript which provides you with the tag API and functionalities described bellow. It also contains named configurations of supported ad server instances (you will learn about them bellow).

Just place the following into the <HEAD> section of your page or into the container tag which should also be placed as close to the head as possible for a maximum speed of ad loading:

Insertion of tag engine:

<script language='javascript'>
   function onIbbTagEngineLoaded() {
       //insert necessary API calls described bellow here
   }
</script>
<script id='ibbTagEngine' language='javascript' src='//bbcdn-static.bbelements.com/scripts/ibb-async/stable/tag.js' onload='onIbbTagEngineLoaded()' ></script>

Function onIbbTagEngineLoaded() would contain particular API requests and mapped positions, which will be explained bellow and it would be called on onload event. 

Of course it is possible to insert it without any function:

<script id='ibbTagEngine' language='javascript' src='//bbcdn-static.bbelements.com/scripts/ibb-async/stable/tag.js' ></script>
<script>
//insert necessary API calls described bellow here
</script>

We strongly suggest to externalise the second part into a file as well, as this will make any future changes easier. The code would then look like this:

<script id='ibbTagEngine' language='javascript' src='//bbcdn-static.bbelements.com/scripts/ibb-async/stable/tag.js' ></script>
<script language='javascript' src='site-section-slot-config.js'></script>

Instead of generic site-section-slot-config.js you would have a concrete file for each section of the site and name the file accordingly, such as mySite-homepage-slot-config.js  and mySite-sports-football-slot-config.js

In the files themselves, you would have appropriate configuration and API calls as described bellow.

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

Navigation


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