Campaign

How do I implement a responsive ad unit?

Responsive ad units automatically adapt to different screen sizes, making them particularly suitable for modern, mobile-optimised websites.

How it works

The creative is loaded within an iframe at the location on your website where you position our integration code or the placeholder HTML container. The number and design of the ads can be freely configured by you via the ad block layout form in the publisher front end.

Unlike static ads, however, it is important that the surrounding HTML container has correct height and width specifications, as our advertisements dynamically adapt to them later. Responsive ads are therefore particularly suitable for websites that are optimised for different screen sizes. 

If the size of the surrounding HTML container is not sufficient for the advertisements to fit with their originally configured design, our responsive logic will automatically attempt to modify them accordingly:

  • Texts or elements are scaled down

  • Individual elements are hidden (e.g. ad link, button or image)

  • Ads are rearranged within the ad block


Integration methods

There are two ways to integrate responsive ads on your website.

Unlike static ads, it is important for responsive ads that the surrounding HTML container always has correct height and width specifications, as our advertisements align accordingly later!


Asynchronous (Recommended)

Thanks to asynchronous integration, your website loads independently of our ad request. First, you place the desired HTML containers at the positions on your website where advertisements should appear. The containers must have a unique ID and correct height and width specifications. Our delivery API is then loaded once and asynchronously using a dynamic <script> tag. As soon as the API has finished loading, a global callback function is executed in which the actual integration logic is stored.

This type of integration is particularly suitable if you want to place multiple AdUp creatives on your page. By programmatically defining the ad blocks, various events are also available here to which you can react accordingly (e.g. "onClick" or "onNoAds").

<!-- 1. Define the HTML container with a unique ID 
        and correct height & width -->
<div id="adup1" style="width:90%;height:200px;">

<!-- 2. Load our JavaScript API and replace the HTML placeholder with 
        the desired creatives in the callback once the API is available -->
<script type="text/javascript">
    window.uAd_init = function() {
        window.uAd.embed("adup1", {
            param1: "value1",
            param2: "value2"
            ...
        });
    };
 
    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>
<!-- 1. Define the HTML container with a unique ID 
        and correct height & width -->
<div id="adup1" style="width:90%;height:200px;">

<!-- 2. Load our JavaScript API and replace the HTML placeholder with 
        the desired creatives in the callback once the API is available -->
<script type="text/javascript">
    window.uAd_init = function() {
        window.uAd.embed("adup1", {
            param1: "value1",
            param2: "value2"
            ...
        });
    };
 
    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>
<!-- 1. Define the HTML container with a unique ID 
        and correct height & width -->
<div id="adup1" style="width:90%;height:200px;">

<!-- 2. Load our JavaScript API and replace the HTML placeholder with 
        the desired creatives in the callback once the API is available -->
<script type="text/javascript">
    window.uAd_init = function() {
        window.uAd.embed("adup1", {
            param1: "value1",
            param2: "value2"
            ...
        });
    };
 
    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>


Synchronous

With synchronous integration, a <div> tag with the desired width and height specifications is first placed at the location on your website where the creative should appear. A <script> tag with the corresponding URL parameters is placed within the <div> tag. When your website loads, the script is then automatically (synchronously) executed and creates an iframe with our advertisements at the corresponding position.​

This is the simplest way to integrate AdUp creatives. However, unlike asynchronous integration, not all options are available here due to defining the ad block via URL parameters.

<!-- The desired creative appears at the location on your website 
     where you position this script -->
<div style="width:90%;height:200px;">
    <script type="text/javascript" 
            src="https://s.d.adup-tech.com/ads/responsive.js?param1=value1&param2=value2...">
    </script>
</div>
<!-- The desired creative appears at the location on your website 
     where you position this script -->
<div style="width:90%;height:200px;">
    <script type="text/javascript" 
            src="https://s.d.adup-tech.com/ads/responsive.js?param1=value1&param2=value2...">
    </script>
</div>
<!-- The desired creative appears at the location on your website 
     where you position this script -->
<div style="width:90%;height:200px;">
    <script type="text/javascript" 
            src="https://s.d.adup-tech.com/ads/responsive.js?param1=value1&param2=value2...">
    </script>
</div>


Required parameters

Name

Description

Example

placementkey

The unique placement key of your ad block.

Asynchronous (programmatic)

placementkey: "dd9e2c6e8a1ec4bc5d1561564fcf946d"
placementkey: "dd9e2c6e8a1ec4bc5d1561564fcf946d"
placementkey: "dd9e2c6e8a1ec4bc5d1561564fcf946d"

Synchronous (URL parameter)

placementkey=dd9e2c6e8a1ec4bc5d1561564fcf946d
placementkey=dd9e2c6e8a1ec4bc5d1561564fcf946d
placementkey=dd9e2c6e8a1ec4bc5d1561564fcf946d

responsive

Enables/disables the responsive ads feature for the ad block. 

Note: For "static ads" in the asynchronous integration, the parameter must always be set to "false"!

Asynchronous (programmatic)

responsive: true
responsive: true
responsive: true

Synchronous (URL parameter)

// not available
// not available
// not available


Optional parameters

Name

Description

Example

query

Keywords by which the ads should be filtered. Multiple keywords can be separated by a semicolon.

Asynchronous (programmatic)

// string
query: "Mallorca;Flight"

// array
query: ["Mallorca", "Flight"]
// string
query: "Mallorca;Flight"

// array
query: ["Mallorca", "Flight"]
// string
query: "Mallorca;Flight"

// array
query: ["Mallorca", "Flight"]

Synchronous (URL parameter)

query=Mallorca;Flight
query=Mallorca;Flight
query=Mallorca;Flight

mincpc

This is the minimum price you want to earn for a click. In general, the lower the minimum price, the more campaigns are submitted to you and the more money you can earn due to greater competition on the position. 

Asynchronous (programmatic)

mincpc: 0.15
mincpc: 0.15
mincpc: 0.15

Synchronous (URL parameter)

mincpc=0.15
mincpc=0.15
mincpc=0.15

pageurl

The current URL of the page on which the ad is served. Should always be set if our creative is integrated within one or more nested iframes on your page, as in some circumstances the URL can then no longer be determined by us.

Asynchronous (programmatic)

pageurl: "http://www.example.com"
pageurl: "http://www.example.com"
pageurl: "http://www.example.com"

Synchronous (URL parameter)

pageurl=http%3A%2F%2Fwww.example.com
pageurl=http%3A%2F%2Fwww.example.com
pageurl=http%3A%2F%2Fwww.example.com

skip

Number of ads to be skipped during delivery. Useful when you place multiple creatives on one page.

Asynchronous (programmatic)

skip: 2
skip: 2
skip: 2

Synchronous (URL parameter)

skip=2
skip=2
skip=2

lazy

Enables the "lazy loading" feature. This means that the creative is only loaded (and thus the impression is only tracked) as soon as it enters the visible area of the page for the user.

Asynchronous (programmatic)

lazy: true
lazy: true
lazy: true

Synchronous (URL parameter)

lazy=1
lazy=1
lazy=1

lazyoffset

By default, with "lazy loading", our creatives are only displayed once they are visible to the user. Using the "lazyoffset" option, you also have the possibility to define an offset (in pixels). This allows our creatives to load slightly earlier, as soon as they are "near" the visible area.

Asynchronous (programmatic)

lazyoffset: 500
lazyoffset: 500
lazyoffset: 500

Synchronous (URL parameter)

lazyoffset=500
lazyoffset=500
lazyoffset=500

placeholdervalues

Values for dynamic ad placeholders can be passed here.

Asynchronous (programmatic)

placeholdervalues: {
    "destination": "Paris",
    "price": "299,99€"
}
placeholdervalues: {
    "destination": "Paris",
    "price": "299,99€"
}
placeholdervalues: {
    "destination": "Paris",
    "price": "299,99€"
}

Synchronous (URL parameter)

// not available
// not available
// not available

flyin

Enables the "fly-in ads" feature for the ad block.

Further information and options for this can be found in the documentation on fly-in ads.

Asynchronous (programmatic)

flyin: true
flyin: true
flyin: true

Synchronous (URL parameter)

flyin=1
flyin=1
flyin=1

adtest

Impressions and clicks are not tracked when enabled. Should only be used for testing purposes!

Asynchronous (programmatic)

adtest: true
adtest: true
adtest: true

Synchronous (URL parameter)

adtest=1
adtest=1
adtest=1

gdpr gdpr_consent

Normally, we determine the required GDPR data automatically via the TCF API implemented on the website. 

​Should this not be available, or should it not be possible to use it for technical reasons, you have the option here to pass the GDPR data manually.

​gdpr

true or 1 = GDPR applies

false or 0 = GDPR does not apply

null or (omitted) = Unknown (default)

​gdpr_consent

The IAB consent string (base64url-encoded)

Asynchronous (programmatic)

gdpr: true,
gdpr_consent:"[CONSENT_STRING]"
gdpr: true,
gdpr_consent:"[CONSENT_STRING]"
gdpr: true,
gdpr_consent:"[CONSENT_STRING]"

Synchronous (URL parameter)

gdpr=1&gdpr_consent=[CONSENT_STRING]
gdpr=1&gdpr_consent=[CONSENT_STRING]
gdpr=1&gdpr_consent=[CONSENT_STRING]


Events / Callbacks

Name

Description

Example

onClick

Is automatically called as soon as an advertisement has been clicked. The first (and only) parameter returned is the rank of the ad within the creative.

Asynchronous (programmatic)

onClick: function(rank) {
    console.log("ad " + rank + " clicked");
}
onClick: function(rank) {
    console.log("ad " + rank + " clicked");
}
onClick: function(rank) {
    console.log("ad " + rank + " clicked");
}

Synchronous (URL parameter)

// not available
// not available
// not available

onResize

Is automatically called as soon as the size of the creative changes (e.g. for advertorial ads). The first parameter returned is the new width and the second parameter is the new height.

Asynchronous (programmatic)

onResize: function(width, height) {
    console.log("new size is " + width + "x" + height);
}
onResize: function(width, height) {
    console.log("new size is " + width + "x" + height);
}
onResize: function(width, height) {
    console.log("new size is " + width + "x" + height);
}

Synchronous (URL parameter)

// not available
// not available
// not available

onAds

Is automatically called as soon as the creative has been loaded successfully. The first (and only) parameter returned is the container ID.

Asynchronous (programmatic)

onAds: function(id) {
    console.log("ads for " + id);
}
onAds: function(id) {
    console.log("ads for " + id);
}
onAds: function(id) {
    console.log("ads for " + id);
}

Synchronous (URL parameter)

// not available
// not available
// not available

onNoAds

Is automatically called as soon as the creative could not be delivered. The first (and only) parameter returned is the container ID.

Asynchronous (programmatic)

onNoAds: function(id) {
    console.log("no ads for " + id);
}
onNoAds: function(id) {
    console.log("no ads for " + id);
}
onNoAds: function(id) {
    console.log("no ads for " + id);
}

Synchronous (URL parameter)

// not available
// not available
// not available


Troubleshooting

The responsive creative is too small, too large, is not displayed or overlaps other elements.

  • The HTML container does not have explicit size specifications, but these are required

  • There are other elements inside the HTML container in addition to the script tag

Fewer ads are served via responsive ads than via static ads, or the number of ads does not match.

  • The "Integration method" in the ad block layout form was not set to "Responsive Ads"

  • The "Number of ads" in the ad block layout form was not configured correctly

The responsive advertisements are not displayed correctly in mobile browsers (smartphones/tablets).

  • To ensure that our "responsive ads" are also legible in mobile browsers, it is necessary that the "viewport" meta tag is correctly set on your website

The layout of the advertisements (rows/columns) does not match the preconfigured layout.

  • The responsive logic decides for itself which layout fits best based on the current size of the HTML container and always attempts to display the layout with the largest font size and the largest ad image (if available)

The displayed font size does not match the preconfigured font size

  • The font size is automatically scaled down as soon as the advertisement with the configured font size does not fit into the given HTML container

  • To ensure that our "responsive ads" are also legible in mobile browsers, it is necessary that the "viewport" meta tag is correctly set on your website

The ad images are too small or do not fill the available space

  • Depending on the selected layout, the ad images always scale proportionally with the height or width of the advertisement, whereby the aspect ratio is always maintained

  • However, the ad images are never scaled larger than the (maximum) image size preconfigured in the ad block layout form

Ad images, texts or links are not displayed

  • If the HTML container is so small that even scaling down the texts is not sufficient to display the advertisement properly, our responsive logic will attempt in a final step to hide individual elements (link, text, button or ad image) to save space

  • In this case, the layout of your ad block should generally be designed to be more space-saving (e.g. smaller font sizes or margins)