Installation

Our Delivery API

Our delivery API offers the possibility to create, update or removeResponsive Ads or Static Adsasynchronously. It is a global javascript object named window.uAd, which provides the corresponding methods.

Loading the API

It must always be ensured that the delivery API is only loaded once per page request, otherwise the global callback function window.uAd_init may be executed multiple times, and the corresponding advertising media will also be displayed multiple times!

 

Loading via <script> tag (simple)

Perfectly sufficient if the embed code is to be placed in only one place on your page, our delivery API is loaded once and asynchronously using dynamic <script> tag. Once the API has finished loading, a global callback function window.uAd_init is executed, which stores your actual embedding logic.

...
<script type="text/javascript">
    window.uAd_init = function() {
        window.uAd.embed(...)
        // window.uAd.reload(...)
        // window.uAd.remove(...)
    };
  
    if (typeof window.uAd === "object") window.uAd_init();
    else (function(d, t) {
        var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
        g.src = "https://s.d.adup-tech.com/jsapi"
        g.async = true;
        s.parentNode.insertBefore(g, s);
    }(document, "script"));
</script>
...
Loading via <script> tag (extended)

Here, the logic from the simple example (above) is offloaded to a function called "adup". This takes care that the API is loaded only once. As a parameter, a callback function is passed with your desired inclusion logic, which is automatically executed as soon as our delivery API is ready.

This is especially useful if, for example, you have several ads in different places on your page and / or ads should be placed, updated or removed during the runtime on your page.

...
<script type="text/javascript">
    function adup(callback) {
        if (window.uAd) {
            callback();
        } else if (window.uAd_init) {
            var oldCallback = window.uAd_init;
            window.uAd_init = function() {
                oldCallback();
                callback();
            };
        } else {
            window.uAd_init = callback;
            (function(d, t) { 
                var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
                g.src = "https://s.d.adup-tech.com/jsapi"
                g.async = true;
                s.parentNode.insertBefore(g, s);
            }(document, "script"));    
        }
    }
</script>
...
<script type="text/javascript">
    adup(function() {
        // window.uAd.embed(...)
        // window.uAd.reload(...)
        // window.uAd.remove(...)
    });
</script>
...
<script type="text/javascript">
    adup(function() {
        // window.uAd.embed(...)
        // window.uAd.reload(...)
        // window.uAd.remove(...)
    });
</script>
...
Loading as AMD module

The API can be loaded as an AMD module(http://requirejs.org/docs/whyamd.html). This method requires the use of an AMD loader (e.g.http://requirejs.org).

To do this, you must first define the path to the API in the RequireJS options and include the RequireJS library. Afterwards, our API can be loaded or used anywhere on your page using the require method.

...
<script type="text/javascript">
    var require = {
        paths: {
            "uAd": "https://s.d.adup-tech.com/jsapi"
        }
    };
</script>
...
<script type="text/javascript" 
        src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js">
</script>
...
<script type="text/javascript">
    require(["uAd"], function() {
        // window.uAd.embed(...)
        // window.uAd.reload(...)
        // window.uAd.remove(...)
    }); 
</script>
...
<script type="text/javascript">
    require(["uAd"], function() {
        // window.uAd.embed(...)
        // window.uAd.reload(...)
        // window.uAd.remove(...)
    }); 
</script>
...

Integrate advertising material

Prerequisites

In order to be able to integrate ad media asynchronously, you must ensure that the delivery API has been loaded correctly. You can find out more about this in the Loading the API section at the top of this page.

How it works

With the help of the embed function of the API object window.uAdyou have the possibility to load ads within an existing HTML container on your page. The HTML container must have a unique ID, which is passedas the first parameter when window.uAd.embed is called. The options for the desired ad media are passed as the second parameter in the form of a JSON object. The API then generates an iFrame with the corresponding ads within the HTML container.

Syntax
window.uAd.embed("Container ID", {
    option: "value",
    option: "value",
    ...
});
Example
...
<div id="adup1"></div>
...
<script type="text/javascript">
    window.uAd_init = function() {
        window.uAd.embed("adup1", {
            placementkey: "dd9e2c6e8a1ec4bc5d1561564fcf946d",
            responsive: false
        });
    };
  
    if (typeof window.uAd === "object") window.uAd_init();
    else (function(d, t) {
        var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
        g.src = "https://s.d.adup-tech.com/jsapi"
        g.async = true;
        s.parentNode.insertBefore(g, s);
    }(document, "script"));
</script>
...

You can find further integration examples in the documentation onResponsive Ads and Static Ads.

Update advertising media

Prerequisites

In order to update ad media, you need to ensure that the delivery API has been loaded correctly. You can read more about this in the Loading the API section earlier on this page.

How it works

With the help of the reload function of the API object window.uAd you have the possibility to update an already existing ad media. To do this, the unique ID of the HTML container of the ad media is passed to the window.uAd.reload function. The iFrame previously generated by window.uAd.embed will be reloaded with the same options.

An ad may be reloaded by window.uAd.reload at most every 10 seconds. When an ad is reloaded, a new impression is always tracked.

Syntax
window.uAd.reload("Container ID");
Example
...
<div id="adup1"></div>
...
<script type="text/javascript">
    window.uAd_init = function() {
        // Initial embedding
        window.uAd.embed("adup1", {
            placementkey: "dd9e2c6e8a1ec4bc5d1561564fcf946d",
            responsive: false
        });

        // Automatically refreshes every 30 seconds
        setInterval(function() {
             window.uAd.reload("adup1");  
        }, 30000);
    };
  
    if (typeof window.uAd === "object") window.uAd_init();
    else (function(d, t) {
        var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
        g.src = "https://s.d.adup-tech.com/jsapi"
        g.async = true;
        s.parentNode.insertBefore(g, s);
    }(document, "script"));
</script>
...

Remove advertising material

Prerequisites

In order to remove ads, you need to make sure that the delivery API has been loaded correctly. You can read more about this in the Loading the API section at the top of this page.

How it works

With the help of the remove function of the API object window.uAd you have the possibility to remove an already embedded ad. To do this, the unique ID of the HTML container to be removed is passed to the window.uAd.remove function.

Syntax
window.uAd.remove("Container ID");
Example
...
<div id="adup1"></div>
...
<script type="text/javascript">
    window.uAd_init = function() {
        // Initial embedding
        window.uAd.embed("adup1", {
            placementkey: "dd9e2c6e8a1ec4bc5d1561564fcf946d",
            responsive: false
        });

        // Removes ad after 120 seconds
        setTimeout(function() {
             window.uAd.remove("adup1");  
        }, 120000);
    };
  
    if (typeof window.uAd === "object") window.uAd_init();
    else (function(d, t) {
        var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
        g.src = "https://s.d.adup-tech.com/jsapi"
        g.async = true;
        s.parentNode.insertBefore(g, s);
    }(document, "script"));
</script>
...