The embed

One script tag, ~3 KB gzipped, no dependencies, no cookies. It reserves its space before loading (zero layout shift), blends into the host theme — including live dark-mode toggles — and quietly shows a fallback if anything is down.
Open the live demo page

Drop-in

Put a placeholder where the ad should render (you can have several per page), then load the script once:

<div data-devmatei-ad data-tier="text"></div>

<script async src="https://ads.devmatei.com/embed/ad.js"></script>

Single-slot shortcut — the widget renders right where the script tag sits:

<script async src="https://ads.devmatei.com/embed/ad.js" data-tier="banner"></script>

Options

All options are data attributes on the placeholder (or on the script tag as defaults):

AttributeValuesDefaultWhat it does
data-tiertext | bannertextWhich tier this slot shows.
data-max-widthany CSS width380px text · 728px bannerMaximum width of the widget.
data-alignleft | center | rightcenterHorizontal placement inside the container.
data-themeauto | light | darkautoauto samples the host page's colors (and tracks live theme switches); light/dark force a preset.
data-radiusany CSS radius10pxCorner rounding of the card.
data-fallback-texttextbuilt-in copyShown (as a link) when no ad is active or the API is unreachable. Set to an empty string to hide the widget instead.
data-fallback-urlURLhttps://ads.devmatei.comWhere the fallback card links — e.g. your “buy this slot” page or Ko-fi.

A fallback that earns its keep

When a tier has no active ads (or the ad server is unreachable), the slot renders your fallback text as a link instead of breaking or collapsing:

<div data-devmatei-ad data-tier="banner"
     data-fallback-text="This slot is free — advertise here, or buy me a coffee."
     data-fallback-url="https://ko-fi.com/yourname"></div>

Behavior guarantees

— Space is reserved before any network request — no layout shift, ever.

— Impressions count only after the ad is actually ≥50% visible.

— Theme colors are re-derived live when the host toggles class/data-theme or the OS scheme changes.

— Any failure (offline, blocked, server down) renders the fallback silently — no console noise.

— Exactly two requests per shown ad: one fetch, one beacon. No cookies, no storage, no fingerprinting.


ads.devmatei.com — hand-reviewed ads for indie projects.

Embed docs · ads.devmatei.com