Checking service

Sponsor units: the Swoop tag

One script line, no cookies, no trackers.

A unit is one sponsored card on your page: a banner, a text card or a native card with an image. The Swoop tag puts it there with one script line. It is small (under 6 KB), uses no cookies, loads nothing from other sites and cannot break your page. It follows the ad rules: an exact size or nothing, no pop-ups, no sound, no layout shift, one unit in view on a phone, never on money, sign-in or form pages.

Add a unit in one line#

Paste this where the unit should appear. Use your own public Spot key from the app; it is safe to put in a page.

html
<script src="https://swoopads.xyz/t.js" data-spot="pk_YOUR_SPOT_KEY" data-unit="native" data-size="480x160" async></script>

That is the whole install. The Install screen in the app lets you pick the kind and colours, shows a live preview and writes the line for you.

Options#

Set them as data- attributes on the script, or on any element with the class swoop-unit (write data-swoop-spot, data-swoop-unit and so on).

AttributeValuesWhat it does
data-spotpk_…Your public Spot key. Without it a unit shows only on Swoop pages. Sponsors shown through a unit with your key, on a site you have proven, earn you the creator share, paid to the Spot’s wallet.
data-unitbanner, text, native, videoThe kind of unit. Default native. See Video unit below for video.
data-themelight, dark, autoColours of the card. auto follows the reader’s device. Default auto.
data-sizea listed size, such as 728x90The exact size of the unit. Without it the tag takes the biggest listed size that fits the space. If the size does not fit the space, or the creative does not fit the size exactly, nothing is drawn.
data-width300 to 1200The widest size the tag may pick, in pixels.
data-blocka CSS selectorExtra places that mean “no ads on this page”, on top of the built-in list (password, email, card and one-time-code fields, and anything marked data-swoop-no-ads).
data-slota spot idWhich sponsor spot to fill. Default watch_rail for banners, home_feed for the others. See the list in the API reference.
data-targeta CSS selectorWhere to draw it. Default: right after the script (at the end of the page if the script is in the head).
data-page, data-creator, data-content, data-topictextContext for choosing the ad. data-page says what kind of page this is, for example article or home. Pages where money moves (checkout, buy, claim, swap, send) and sign-in pages never show ads, whatever this says: the page address is checked too.

The kinds and their sizes#

KindWhat readers seeSizes (pixels)Image
Banner bannerAn image the exact shape of the box, labelled Sponsored.1200x400, 970x250, 728x90, 600x200, 468x60, 320x100, 320x50, 300x250an image of the same shape as the box, at least as big
Native card nativeA small picture, a headline, a line of text and a button.480x160, 320x140any picture; it keeps its shape at the box height
Text only textA headline, a line of text and a button. No image.728x90, 480x120, 320x140no image
Video videoA short sponsor clip in its own slot between paragraphs. Muted, it plays once while it is in view. One per page.1280x720, 960x540, 640x360, 480x270, 320x180a still picture instead of the clip on slow connections, Save-Data or reduced motion

A unit is drawn at one of these sizes, exactly. A banner image must have the same shape as the box and be at least as big (it is only ever scaled down, never stretched or cropped); a native card’s picture keeps its own shape; text that would be cut is not drawn. When nothing fits, the slot stays empty and takes no space.

Every unit says Sponsored and has Why this ad?, Hide and Report. People can hide an ad or report it for a reason, and a reported ad leaves the page at once. Anyone can also send a longer note at swoopads.xyz/report, with no account. You cannot remove those labels.

Units never show on pages where money moves or people sign in: a page whose address names checkout, pay, buy, sell, swap, trade, claim, mint, deposit, withdraw, send, sign-in, login, wallet, settings or a similar step gets nothing, and neither does a unit placed inside a form.

Video unit#

From version 1.1 the tag can draw a short sponsor clip in its own slot, between paragraphs: data-unit="video". It is built to stay out of the reader’s way.

  • Fits or stays out. The slot is one listed 16:9 size (1280x720, 960x540, 640x360, 480x270, 320x180), the biggest that fits its container. A container narrower than 320 px, no sponsor, or a second video unit on the same page means nothing is drawn (zero height, no gap).
  • No layout shift. The slot opens only while it is off screen. A unit that is already on screen when its clip arrives waits until the reader has scrolled away from it.
  • Quiet. Always muted. It plays only while at least half of it is on screen, pauses when the reader scrolls away, plays once and then keeps a still frame. Sound comes on only when the reader taps Tap for sound.
  • Light on data. With Save-Data, a 2G connection or reduced motion, no video is loaded at all: the reader sees a still image, or nothing.
  • Safe files only. MP4 (H.264) or WebM over https, 6 to 15 seconds, no scripts in the ad (no VPAID). It is labelled Sponsored and has Hide and Report.
html
<p>…your first paragraphs…</p>
<script src="https://swoopads.xyz/t.js" data-spot="pk_YOUR_SPOT_KEY" data-unit="video" async></script>
<p>…the rest of the article…</p>

Put it inside the text, not at the very top: a unit that is already on screen when the page opens stays empty. One video unit per page; extra ones stay empty.

End and pause cards#

Cards drawn over your own video player are not offered: they cover what the viewer came for, and Swoop ads never sit over content (ad rules). Swoop.endCard and Swoop.pauseCard still exist so older code does not break, but they draw nothing and return null.

Pin an exact version#

The short address /t.js always serves the latest 1.x. To freeze what runs on your page, use the exact address with its integrity hash. If the file ever changed by a single byte, browsers would refuse to run it.

html
<script src="https://swoopads.xyz/t/1.1.0.js" integrity="sha384-TdTzA4ueOm72L7h6secO0fNlEegFSFA6ea7adoYFg4zAQ2203PAUwP1b2Kw0DCsg" crossorigin="anonymous" data-spot="pk_YOUR_SPOT_KEY" data-unit="native" data-size="480x160" async></script>

Version 1.1.0, hash (SHA-384) of the file at swoopads.xyz/t/1.1.0.js:

integrity
sha384-TdTzA4ueOm72L7h6secO0fNlEegFSFA6ea7adoYFg4zAQ2203PAUwP1b2Kw0DCsg

The same facts as data: swoopads.xyz/t/sri.json (the newest version, and under versions every earlier one with its hash). A new version gets a new address and a new hash; old addresses never change, byte for byte.

JavaScript#

For pages that draw content with JavaScript, the tag adds a small Swoop object.

Mount
js
const unit = Swoop.mount(document.querySelector('#sponsor'), {
  spot: 'pk_YOUR_SPOT_KEY',
  unit: 'banner',
  theme: 'dark',
  onState: (state, detail) => console.log(state, detail.reason),
})
unit.refresh() // ask for another ad
unit.destroy() // remove it
Before it loads
html
<script>
  window.swoopQ = window.swoopQ || []
  swoopQ.push(function (Swoop) {
    Swoop.mount(document.getElementById('sponsor'), { spot: 'pk_YOUR_SPOT_KEY' })
  })
</script>
<script src="https://swoopads.xyz/t.js" async></script>
Events
js
const el = document.getElementById('sponsor')
el.addEventListener('swoop:filled', () => el.classList.add('has-ad'))
el.addEventListener('swoop:viewed', () => {})
el.addEventListener('swoop:empty', (e) => console.log('nothing to show:', e.detail.reason))
StateWhen
filledA sponsor card is on screen.
viewedHalf of it has been on screen for a second. One view is counted, once.
emptyThere is nothing to show: no sponsor, no fitting size (no_fit, size_mismatch), a money, sign-in or form page, or the reader hid or reported it. The reason is on the unit as data-swoop-reason. The unit takes no space.
playing, endedVideo unit only: the clip started (muted, in view) and the clip finished; it stays on its last frame.

The unit always carries its state as data-swoop-state (for example data-swoop-state="empty"), so a page can style around it.

Privacy#

  • No cookies, no storage, no consent banner needed for the unit. The tag writes nothing to the reader’s device.
  • No trackers. An ad is chosen from the page it appears on, never from a profile of the reader. Counting is first party; a reader is a salted hash that changes every UTC day.
  • Isolated. The unit runs in a sandboxed frame from offers.kre8.fun. It cannot read your page, and your page cannot read it. It cannot send the reader away from your page: links open in a new tab.

Content Security Policy#

If your site sets a Content Security Policy, allow the script and the frame (the video plays inside the frame, so your policy needs nothing more for it):

csp
script-src  https://swoopads.xyz
frame-src   https://offers.kre8.fun

If nothing shows#

  1. It is normal for a new unit to stay empty: no sponsor runs on that spot yet. Open the Install screen in the app. It shows live whether a sponsor is running.
  2. Read data-swoop-reason on the unit. money_page, sign_in_page, form_on_page and form_area mean the page is one where ads never show. no_fit means the space is narrower than the smallest size. size_mismatch means the sponsor’s creative does not fit the size exactly.
  3. A unit opens only while it is off screen, so a unit at the very top of a page shows once the reader has scrolled past it and back. On a phone, a second unit within one screen of an open one stays shut.
  4. Check the Spot key and the site address. A web Spot only frames on the site addresses you listed and proved. See proving your site.
  5. Open the browser console. The tag never writes errors, but your browser reports a blocked frame or script, which means a Content Security Policy needs the two lines above.
  6. Readers with ad blockers will not see units, as with any ad.

Safe on your page#

Every call in the tag is wrapped, bad values fall back to defaults, and messages from any other window or address are ignored. A failure collapses the unit. It does not throw into your code and does not move your layout: a unit opens only while it is off screen, and an empty unit has zero height.

Version 1.0.0#

/t/1.0.0.js still serves the same bytes and hash as when it was published, but it predates the ad rules, so units it asks for stay empty. Move to /t.js or pin the current version above.

Next: the SDK for React and typed code, phone apps, and the step-by-step guide.