Appendix B. Developer Reference
For template developers: the markup CLS Ad Slot writes, the CSS classes and data attributes it uses, and the events its script emits.
You don't need anything in this appendix to use CLS Ad Slot. It is here for developers who want to style slots, override the module's layout, or react to what happens to an ad.
Generated Markup
A responsive Display slot with lazy loading and fallback content on, for module id
42:
<div id="jch-adslot-42" class="jch-adslot jch-adslot--responsive jch-adslot--module-42" style="">
<template class="cls-ad-template">
<ins class="adsbygoogle"
data-ad-client="ca-pub-1234567890123456"
data-ad-slot="1234567890"
data-ad-format="auto" data-full-width-responsive="true" style="display: block"></ins>
</template>
<template class="cls-ad-fallback">
<div class="cls-ad-fallback-wrapper">…your fallback content…</div>
</template>
</div>
Its heights are added to the page's head, once per module:
.jch-adslot.jch-adslot--module-42 { min-height: 280px; }
@media (max-width: 991px) { .jch-adslot.jch-adslot--module-42 { min-height: 250px; } }
@media (max-width: 575px) { .jch-adslot.jch-adslot--module-42 { min-height: 250px; } }
-
When the same module is shown more than once on a page, for example by an injector, the first slot has the id
jch-adslot-42and the next onesjch-adslot-42-2,jch-adslot-42-3and so on. Target the module class rather than the id to style them all. -
The
inselement is wrapped in atemplateonly when lazy loading is on. The script moves it into the slot when the slot comes near the screen. With lazy loading off, it is written directly, followed by the usual(adsbygoogle = window.adsbygoogle || []).push({})script. -
The fallback
templateis present only when Adblock fallback is on. -
In-article slots use
spaninstead ofdiv, with the extra classjch-adslot--inline-block, because the In-Article Injector places them inside a paragraph. -
A fixed-size slot reserves its Height (px) as its single minimum height, and its
inselement getsdisplay:inline-block;width:.Wpx;height:Hpx
On This Page