Data Attributes
Yaleo placements and BTA Feed mark the elements they render with data-* attributes. All Integrations lists the attributes every integration sets. The sections after it list the attributes specific to each one:
All Integrations
Section titled “All Integrations”| Attribute | Element | Value |
|---|---|---|
data-adnz-creative-id |
Native ad link | Creative ID of the winning bid |
data-adnz-bidder |
Native ad link | Bidder code of the winning bid, e.g. appnexus |
data-adnz-xandr-placement-id |
Native ad link | Xandr placement ID of the ad unit |
data-adnz-ad-unit-id |
Tracker <script> |
Ad unit ID, yaleo-ad-unit-{n} |
data-inner-style |
<style> with the placement styles (iframeLayout) inside the Shadow DOM or the iframe document |
1 |
data-outer-style |
<style> with the parent page styles (parentPageLayout) in the document that holds the host and, when it differs, the slot’s document |
1 |
- The native ad link is the
<a>with classyaleo-item--adin the new markup,yaleo-adin the legacy markup. Itsidis the ad unit ID. An unfilled ad replaced by its fallback article renders as an article and has none of the native ad attributes. - Tracker scripts are created from the ad’s JavaScript trackers (for example, Xandr’s
trk.jsviewability script) once the ad reaches the viewport. They are appended to the<body>of the document the placement renders in: the iframe document in iFrame mode and with Prebid Integration, the top document in Shadow DOM mode.
Direct Integration
Section titled “Direct Integration”Applies to Direct Integration and the legacy Prebid adapter. The legacy adapter uses Direct Integration under the hood: its renderer, https://cdn.adnz.co/yaleo/prebid.js, starts the placement with the same start() as window.yaleo.start() and takes its ads from the Prebid bid, so it sets the same attributes.
| Attribute | Element | Value |
|---|---|---|
data-adnz-yaleo-host |
Host. Shadow DOM: the shadow host <div>. iFrame: the <iframe> Yaleo creates, or with iframeMode the existing iframe Yaleo renders into. |
Yaleo placement ID |
data-adnz-yaleo-slot |
Slot | Yaleo placement ID |
data-media-style |
iFrame mode only. One <style> per @media block of the placement styles whose query matches the viewport window (the top window by default). Removed when the query stops matching. |
1 |
The setupYaleo script (Headertag Raw JS) sets data-adnz-shown="1" and data-adnz-loaded="1" on the target element before calling start(), and waits while it carries data-hydrated="0". See Placements and Hydration.
BTA Feed
Section titled “BTA Feed”Applies to BTA Feed loaded from https://cdn.adnz.co/bta-feed/index.js.
| Attribute | Element | Value |
|---|---|---|
data-adnz-bta-feed-host |
Host: the feed container, <div id="bta-feed-container-{btaFeedId}" class="bta-feed-container"> |
BTA Feed ID |
data-adnz-bta-feed-slot |
Slot | BTA Feed ID |
data-adnz-bta-feed-root-id |
Target element: element passed to start(), or the one created next to the script tag |
bta-feed-root-{btaFeedId} |
data-adnz-yaleo-host |
Shadow host <div> of each Yaleo placement widget |
Yaleo placement ID |
The feed marks the slot. Its Yaleo placement widgets mark only their host.
start() exits without rendering when the document already has an element with the same data-adnz-bta-feed-root-id, so each BTA Feed ID renders once per page. The attribute is set before the isDisabled and backend enabled checks, so a disabled feed also blocks a second start with the same ID.
The setupBtaFeed script (Headertag Raw JS) sets data-adnz-shown="1" and data-adnz-loaded="1" on the target element before calling start(), and waits while it carries data-hydrated="0". See Placements and Hydration.
Publisher-defined Attributes
Section titled “Publisher-defined Attributes”BTA Feed applies extra data attributes passed to window.adnzBtaFeed.start(). Keys must start with data-, values are strings or numbers.
| Option | Element |
|---|---|
containerAttributes |
Shadow host <div class="bta-feed-shadow-root"> inside the feed container |
getWidgetAttributes({ btaFeedId, widget }) |
Widget <div class="bta-widget"> |
getArticleAttributes({ article, index, fallback, btaFeedId, widget }) |
container: article root. image: image <div class="yaleo-media"> (new markup) or image link (legacy markup). body: text <div class="yaleo-body"> (new markup) or text link (legacy markup). |
getAdAttributes({ adUnit, index, btaFeedId, widget }) |
container: native ad link. The native ad attributes take precedence over the same keys. |
getArticleAttributes and getAdAttributes run for items of Yaleo placement widgets. getArticleAttributes also runs for fallback articles, with fallback: true.
window.adnzBtaFeed.start({ btaFeedId: '00000000-0000-0000-0000-000000000000', containerAttributes: { 'data-section': 'bta-feed' }, getWidgetAttributes: ({ widget }) => ({ 'data-widget-position': widget.position + 1 }), getArticleAttributes: ({ article, index }) => ({ container: { 'data-article-id': article.id, 'data-item-position': index + 1 }, }), getAdAttributes: ({ adUnit, index }) => ({ container: { 'data-ad-id': adUnit.id, 'data-item-position': index + 1 }, }),});Prebid Integration
Section titled “Prebid Integration”Applies to Prebid Integration through the Yaleo Bid Adapter. The legacy adapter uses Direct Integration under the hood and is covered in Direct Integration.
| Attribute | Element | Value |
|---|---|---|
data-adnz-yaleo-host |
Host: the iframe the Prebid creative renders into, when it is same-origin. Removed on unmount while it still holds this ID. | Yaleo placement ID |
data-adnz-yaleo-slot |
Slot | Yaleo placement ID |
data-media-style |
One <style> per @media block of the placement styles whose query matches the top window viewport. Removed when the query stops matching. |
1 |
The bidder server writes the placement styles into the rendered HTML as <style data-inner-style="1">.
In a cross-origin creative iframe, the placement marks no host or slot and injects the parent page styles into its own document.
Host and Slot
Section titled “Host and Slot”The host and slot attributes give parent page styles a selector for elements outside the placement’s own document.
- Host — the element that holds the placement or feed in the parent document.
- Slot — the parent element of the outermost iframe reachable from the window the placement or feed runs in. The walk up stops at the first cross-origin frame. No slot is marked when the placement or feed runs in the top window, or when that parent is
<body>or<html>. When two placements, or two feeds, share a slot, the latest ID wins. Unmounting removes the attribute only while it still holds that ID.
Placeholders in parent page styles are replaced with selectors for these attributes:
| Placeholder | Replaced with |
|---|---|
__YALEO_HOST__, .bc-frame |
[data-adnz-yaleo-host="{yaleoPlacementId}"] |
__YALEO_SLOT__ |
[data-adnz-yaleo-slot="{yaleoPlacementId}"] |
__BTA_FEED_HOST__ |
[data-adnz-bta-feed-host="{btaFeedId}"] |
__BTA_FEED_SLOT__ |
[data-adnz-bta-feed-slot="{btaFeedId}"] |