This library provides a unified solution for integrating advertisements (ads) on all AS24 Tatsu web pages.
This library uses custom-elements which come with the showcar-ui library. In order to use showcar-ads you need to include showcar-ui on your web page OR a polyfill for
document.registerElement e.g. WebReflection/document-register-element.
To include the showcar-ads library you can use our jigsaw fragment:
<!--#include virtual="/assets/external/showcar-ads/showcar-ads-fragment.html" -->
Like in the showcar-ui library there are two versions of the "showcar-ads" library: "master" and "develop".
By using URL parameters we can compare these two for any page that uses the ads library. So we can be sure that our changes won't break your page.
In case you want to disable all ads in order to e.g. do performance tests you can do so by providing the "ads-off" parameter in the page URL like so:
In order to integrate the library using SSI, just use following snippet in your Scala template:
<!--#include virtual="/assets/external/showcar-ads/showcar-ads-fragment.html?sc_ads_master_ver=@sc_ads_master_ver&sc_ads_develop=@sc_ads_develop&sc_ads_develop_ver=@sc_ads_develop_ver" -->
Note: Please, integrate the following URL parameters in your application sc_ads_master_ver, sc_ads_develop, sc_ads_develop_ver. => Get these url parameters in your Scala controller and pass them to the virtual include template
To integrate an ad slot on your page you need to define an "as24-ad-slot" element in your HTML like this:
The possible sizes of an ad slot must be defined as a mapping between min-resolution and possible sizes: e.g.
size-map-728x300="728x90, 728x300" - which means if the window resolution is greater or equals 728x300 then we let Doubleclick choose ads with a format of 728x90 or 728x300 pixels.
Please note: pixels are always CSS pixels.
If size-map-0x0 is omitted then an empty mapping is assumed.In the following example ads are only displayed when screen resolution equals or is higher than 728x300 pixels.
For Ad-Targeting integration you can use the "as24-ad-targeting" element like so:
There are some countries in which the loading of ads is prohibited without having the user's consent
for accepting third party cookies. Usually it is wished that the ads are loaded as soon as the user
agrees with this. In this case a "cookie-consent-given" event has to be triggered OR the
cookieConsent=1 cookie needs to be set before.
ad-slot-empty: is fired when there is no ad to show in the slot
ad-slot-loaded: is fired when an ad is loaded in the slot
The ad will be loaded when it nears the viewport (and not just after being in the viewport). The value of the attribute defines the distance how near the ad should be to the viewport to start loading it.
##### collapse-emptyIf no ad can be delivered the slot is collapsed. This can cause the page to jump so use it sparingly. It can be acceptable in some cases.##### immediateThe is loaded immediately. We do not wait until the user scrolls to them.##### openx-ignoreThe ad slot is not included in the OpenX bidding.##### out-of-pageDefines an out of page ad```html
Adds an extra label next to the ad slot to explicitely mark it as an ad. Mostly used on German pages when ads are inside content. By law we are required to visually mark ads as ads.
Each adslot defines a custom
refresh() method. Refresh calls among multiple adslots are collected and called together in a time frame of ca. 50 milliseconds.
Each ad slot automatically receives an AutoScout24 logo as placeholder. This can be overridden by adding one of these classes: