G+J e|MS Tag Control / Ad Implementation
General Information
AdAlliance provides a JavaScript interface that defines methods for configuring calls to the AdAlliance Ad Server. The interface is defined in its own namespace: MoltenBundle.
The interface code for each website is generated dynamically from the AdAlliance tag Control. The tag control allows AdAlliance to make changes to the configuration for advertising integration and to make them live in real time and without the publisher's intervention. With correct integration, for example, the entire advertising playout can be changed or a specific advertising space suppressed within five minutes at the push of a button.
MoltenBundle.js
Contains a JSON configuration, all methods of the tag control, as well as a site-specific JavaScript part, in which e.g. callbacks are defined.
Hosting
AdAlliance provides individual URLs for each website. The preview and productive versions of MoltenBundle.js are then retrieved via these on so-called satellites.
Example:
https://adctrl.emsmobile.de/molten/live/[sitename]/MoltenBundle.bottom.js
https://adctrl.emsmobile.de/molten/preview/[sitename]/MoltenBundle.bottom.js
https://adctrl.emsmobile.de/molten/live/[sitename]/MoltenBundle.top.js
https://adctrl.emsmobile.de/molten/preview/[sitename]/MoltenBundle.top.js
The satellites are not suitable for high-volume access!
They are only configured for collection by external, time-controlled methods. For this reason, only the preview URL is implemented in the page. The live URL is ideally located on the content server of the page and can then be retrieved by CRON job using wget or curl, for example. The recommended time interval is 5 minutes.
Ad integration - Initializing MoltenBundle
The integration of the interface is normally fully asynchronous, i.e. both the initial script and the calls to the ad server are made with asynchronous client-server communication.
Elements in the <head> block
1 2 3 4 5 6 7 8 9 10 |
<script> varGujAd = GujAd || {}; GujAd.cmd = GujAd.cmd || []; GujAd.cmd.push(function() { GujAd.getClient().setSiteType('desktop, mobile or tablet'); GujAd.getClient().setZone('zonename'); GujAd.getClient().setIsIndexPage(true| false); GujAd.getClient().setKeywords(['keyword1','keyword2','keyword3']); }); </script> |
**Keywords are optional**
The site URL is checked for the presence of the parameter "ada=1". If this parameter exists, the site retrieves the interface from the preview system instead of the live system.
The CSS file is loaded and the so-called "command queue" is initialized. All interface method calls are collected in this queue until the interface has been fully loaded.
Elements in the <body> block
1 2 3 4 5 6 7 8 9 10 |
<script type="text/javascript"> !(function(){ vars = document.createElement('script'); s.type = 'text/javascript'; s.async = 'true'; s.src = (window.location.search.indexOf('ada=1') > -1) ? 'Preview – URL': 'Live - URL'; document.body.appendChild(s); })(); </script> |
The JavaScript file is loaded. This <script> block should be included at the very end of the <body> block of the site.
Ad Integration - Initialisierung des MoltenBundle – top.js (ex VDC)
The URL https://bilder-a.akamaihd.net/ip/js/ipdvdc/ipdvdc.min.jshas to be displaced with the internal path to the MoltenBundle.top.js. Loading should take place asynchronous in the head of the page. Das Laden erfolgt weiterhin asynchron im Head der Seite.
https://adctrl.emsmobile.de/molten/live/[sitename]/MoltenBundle.top.js
https://adctrl.emsmobile.de/molten/preview/[sitename]/MoltenBundle.top.js
Integration of ads
The command to load an ad is located in a script block within a div container with an unique ID. The function for loading takes the same ID as parameter.
Code example (not usable)
1 2 3 4 5 6 7 8 9 |
<div class="MoltenBundlehalfpagead"id="halfpagead_1"> <script type="text/javascript"> if(MoltenBundle !== undefined && MoltenBundle.cmd !== undefined) { MoltenBundle.cmd.push(function() { MoltenBundle.push('halfpagead_1'); }); } </script> </div> |
The div container contains exactly the script tag within which the method MoltenBundle.push() is written into the MoltenBundle queue, whereby the position identifier is passed as a JavaScript string.
Which identifiers are to be used can be found in the briefing or the marketing grid.
The container always has the following properties:
-
The advertising item identifier as the ID (this must be unique)
-
The constant CSS class "MoltenBundle“
The identifiers of the individual positions and their exact placement on the various page types are determined by AdAlliance and communicated to the site. Please contact us if you have any problems or would like to make any changes.
When using HTML5, the div tag can be replaced by other semantically more meaningful tags (e.g. figure) without affecting the function.
It is recommended to place site-specific div containers ("wrappers") around the aforementioned ad positions. These can then be positioned individually.
Finalize the ad integration
At the end of the HTML page (ideally directly before the closing body tag) another block must be inserted:
1 2 3 4 5 6 7 8 9 |
<div class="hidden"> <script type="text/javascript"> if(MoltenBundle !== undefined && MoltenBundle.cmd !== undefined) { MoltenBundle.cmd.push(function() { MoltenBundle.finalize(); }); } </script> </div> |
Testing the implementation
To test the implementation, the "testZone" parameter can be appended to a page URL, thus using a test instance as the site configuration. For example, the "develop" zone contains permanent test circuits with placeholder ads.
-
http://mysite.com/sports/?testZone=develop
To switch to the preview instance, use the parameter „ada=1“.
-
http://mysite.com/sports/?ada=1
The parameter "adType" can be used to force the playout of specially created test bookings (the value is assigned by the Ad Management):
-
http://mysite.com/sports/?testZone=livetest&adType=testcampaign
Further configuration functions
Before the integration of ads, basic functions can be adapted and certain targetings can be set. These methods must be called after initializing the command queue. The following methods must have been called before the first MoltenBundle.push call. All calls must be written to the queue when using the fully asynchronous connection:
1 2 3 4 5 6 7 |
<script type="text/javascript"> if(MoltenBundle !== undefined && MoltenBundle.cmd !== undefined) { MoltenBundle.cmd.push(function() { <Methoden-Aufruf>; }); } </script> |
addKeyword(s):
With these functions, elements of keywording can be transferred to the ad server for better targeting. Set all keywordswith an array:
-
MoltenBundle.getClient().setKeywords(['apfel', 'kirsche', 'zimt']);
Add one keyword to the keywords:
-
MoltenBundle.getClient().addKeyword('banane');
Add more keywords to the keywords:
-
MoltenBundle.getClient().addKeywords(['kiwi', 'sahne']);
addTargetingParameter:
With this method it is possible to pass custom targeting parameters:
-
MoltenBundle.getClient().addTargetingParameter('alter','43');
Suppression of advertising
There are multiple ways to suppress the delivery of certain ad variations.
Advertising free page
Within the AdAllianceAdTag Management System, there is a zone called "_noad" in which all advertising spaces are switched off:
-
MoltenBundle.getClient().setZone(‘_noad’);
Deactivating a specific form of advertising
With the aim of not loading a certain ad into the current page:
-
MoltenBundle.getClient().disableAdPosition(‘superbanner_1’);
Bad News
Bad news and advertising may not be compatible. There is a method call for this that causes the AdAllianceAdTag Management System not to trigger an ad call:
-
MoltenBundle.getClient().setPageAsBadNews();
Please use only one of these methods to disable advertising. Otherwise, the data in the ad server analysis tool is corrupted, which leads to errors in the quotation process.
Event Handler
Before embedding an ad, handlers can be defined that react to loading events:
registerBeforeInitialLoadHandler
Registers a function that is executed for initialization:
1 2 3 4 5 6 7 |
MoltenBundle.cmd.push(function() { MoltenBundle.registerBeforeInitialLoadHandler( function(){ alert('hello'); } ); }); |
registerBeforeLoadFirstPositionHandler
Register a function that is executed directly before the first ad call:
1 2 3 4 5 6 7 |
MoltenBundle.cmd.push(function() { MoltenBundle.registerBeforeLoadFirstPositionHandler( function(){ alert('jetzt geht es los'); } ); }); |
registerAllAdsLoadedHandler
Registers a function that is executed after the last ad call:
1 2 3 4 5 6 7 |
MoltenBundle.cmd.push(function() { MoltenBundle.registerAllAdsLoadedHandler( function(){ alert('ready!'); } ); }) |
registerBeforeAdreloadHandler
Register a function that is executed before reloading advertisements:
1 2 3 4 5 6 7 |
MoltenBundle.cmd.push(function() { MoltenBundle.registerBeforeAdreloadHandler( function(){ alert('onceagain'); } ); }); |
registerBeforeLoadAdPositionHandler
Dieser Handler wird aufgerufen, bevor eine Werbeposition geladen wird. Als Parameter wird das aktuelle Positionsobjekt übergeben, welches Informationen über dieses enthält wie z.B. den Namen.
1 2 3 4 5 |
MoltenBundle.cmd.push(function() { MoltenBundle.registerBeforeLoadAdPositionHandler(function(position) { // function code }); }); |
registerAdPositionLoadedHandler
This handler is called after an ad slot has been loaded. The current position object is passed as a parameter, which contains information about it, such as the name or whether an ad is contained.
1 2 3 4 5 |
MoltenBundle.cmd.push(function() { MoltenBundle.registerAdPositionLoadedHandler(function(position) { // function code }); }); |
registerSplitQueueFinishedHandler
This handler is called after theadslots, that were summarized into a splitqueue,have been loaded. In most cases this concerns the above-the-fold adslots, such as the wallpaper, superbanner, billboard and skyscraper slots.
1 2 3 4 5 |
MoltenBundle.cmd.push(function() { MoltenBundle.registerSplitQueueFinishedHandler(function() { // Funktionsinhalt }); }); |
Position opbject:
The position object delivers multiple methods to examineanswersof the adserver.Relevant methods for publishers are the following:
getName(): delivers the name of the adslot, that was called by the handler, as a string, e.g. “superbanner_1”
containsAd(): delivers a booleanwhetherthe adslot contains an ad, or not. In case of “false” as a response, the adslot will be hidden by the molten bundle
getGPTEvent().size:delivers a wide range of google specific values. The most relevant one is the size-Array, where index 0 contains the width and index 1 the height of the ad. Note: 728x600 describes the wallpaper ad.
Ad Reload
To do an AdReload you can choose from the options to reload one ad, a specific set of ads or all ads.
reloadAd
Loads a new ad into the div element with the ID passed as parameter:
1 2 3 |
MoltenBundle.cmd.push(function() { MoltenBundle.getClient().reloadAd('superbanner_1'); }); |
reloadAds
Reloads all ads:
1 2 3 |
MoltenBundle.cmd.push(function() { MoltenBundle.getClient().reloadAds(); }); |
reloadSpecificAds
Reloads the ads specified in the array:
1 2 3 |
MoltenBundle.cmd.push(function() { MoltenBundle.getClient().reloadSpecificAds(['superbanner_1', 'rectangle_1']); }); |
DSGVO
As part ofthe DSGVO we provide extended privacy protection text which can be included in your digital advertising offer. Through this user have the opportunity to objector decline to the collection and processing of their data for personalized advertisement. In case of an existing privacy center you also have the option to directly transfer a OptIn or OptOut action by the user based on the following JavaScript method:
1 |
MoltenBundle.Privacy.isOptedOut() |
Video Control
The VideoControl offers two options for retrieving player targeting. On the one hand, there is a synchronous variant:
1 |
MoltenBundle.Video.getSXPKeys() |
and on the other hand an async variant (recommended):
1 |
MoltenBundle.Video.getSXPKeysAsync() |
The transfer of targeting information for the video control can be done using the following method:
1 |
MoltenBundle.Video.setTargeting(key, value) |