Landmark DocsDashboard →

Reference

window.landmark

Your element's HTML, CSS and JS run inside a sandboxed iframe (sandbox="allow-scripts" only, with no parent access and no cookies). The window.landmark object is your bridge to the stream: the event that fired it, the live event feed, your settings, saved values, text to speech, translation and sound. Standard browser features (DOM, Canvas, requestAnimationFrame, timers, and images, fonts and audio by URL) all work. The iframe has a null origin, so there is no Landmark endpoint to call. fetch and XMLHttpRequest have nothing to talk to, and the AI assistant refuses to write them. localStorage, sessionStorage and cookies are unavailable too. Everything your element needs arrives as an event or through landmark.data (your real menu), and anything it must remember goes in landmark.vars.

Runtime contract version 5. To learn how elements are made, placed, shared and used on their own, see Elements & overlays.

At a glance

window.landmark = {
  event:    { platform, type, usd_amount, payload, occurred_at },  // what fired an alert
  mode:     "alert" | "persistent",   // one-shot pop-up or long-lived widget
  preview:  boolean,                  // true in the editor preview (no sound, no billing)
  config:   { ...settings },          // your _schema settings, keyed by id
  events:   [ ...received ],          // events since this page loaded, newest first, up to 200
  emotes:   { code: imageUrl },       // the streamer's custom chat emotes
  on(type, cb)        => unsubscribe, // listen to the live feed
  vars:    { get(key) => Promise, set(key, value) => Promise },  // saved values for this element
  globals: { get(key) => Promise, set(key, value) => Promise },  // saved values shared by the account
  tts(text, opts?),                   // speak text on the live overlay
  translate(text, lang) => Promise,   // { text, translated, detected }
  sound: { url, volume, play(url?, volume?) },  // the editor's Sound section
  onClearChat(cb) => unsubscribe,     // register a "clear what you drew" handler
  clearChat(),                        // run those handlers
  dismiss(),                          // close an alert early
  data: { kinds, get(kind) => Promise, watch(kind, cb) => unsubscribe }  // your real menu
}

Properties

landmark.event
The event that mounted this element (read only). Shape: { platform, type, usd_amount, payload, occurred_at }. For a persistent element this is a fixed placeholder ({ platform: "", type: "", payload: {} }) that never changes, even after events arrive. Use landmark.on() there. See event payloads for the fields inside payload.
landmark.mode  "alert" | "persistent"
"alert" is a one-shot pop-up that closes after its duration_ms. "persistent" is a long-lived widget (chat box, leaderboard, goal bar, always-on wheel) that mounts once and reacts to the live feed. Branch on it if your element supports both.
landmark.preview  boolean
true in the editor and hub preview, false on the live OBS overlay. The preview silences audio (so a grid of previews stays quiet) and makes landmark.tts() do nothing (so previews never bill). The runtime already handles sound and TTS for you, so you rarely need to read it.
landmark.config  Record<string, unknown>
The values of your _schema settings, keyed by setting id, so a streamer can tune your element without touching code. See Settings for every control type, the list control included. Goals, counters and timers also get _eid, the id the server uses to address them. Always guard: const c = landmark.config || ;
landmark.events  Array<Event>
The events this page has received so far, newest first, up to 200. It is empty when your script first runs, because events arrive after the script starts, and it starts empty again on every OBS reload. Use it to look back over what arrived since the page loaded. It cannot restore history, so keep totals in landmark.vars. Each entry has the same shape as the callback in landmark.on().
landmark.emotes  Record<string, string>
The streamer's installed custom chat emotes, as code to image URL. It arrives shortly after the element loads and refreshes live, so read it for each message. It holds no platform emotes. Those arrive per message in payload.fragments. Handle the fragments first, then match leftover text against this map. Write landmark.emotes literally in your code: the overlay only sends the map to elements that mention it. Emotes can be animated and wide, so size them by one side and let the other follow.

Methods

landmark.on(type, cb) → () => void
Listen to the live event feed. type is any type in the event index below, or "*" for all of them. The callback gets one event { platform, type, usd_amount, payload, occurred_at }. It returns a function that stops listening. This is what makes a chat box, a live leaderboard or an always-on wheel possible.
const off = landmark.on("cheer", (e) => {
  spawnConfetti(e.payload.amount);   // bits
  if ((e.usd_amount || 0) >= 5) landmark.tts(e.payload.user + " cheered big!");
});
// later: off()
landmark.vars.get(key) → Promise<value | null>
landmark.vars.set(key, value) → Promise<true>
Saved JSON values for this element: counters, leaderboards, anything that should survive between fires and OBS reloads. Values must be JSON. On the live overlay they are saved on your account. In the editor preview they are held in memory, and the editor's Variables panel can seed them so a preview shows real-looking numbers.
const n = ((await landmark.vars.get("count")) || 0) + 1;
await landmark.vars.set("count", n);
landmark.globals.get(key) → Promise<value | null>
landmark.globals.set(key, value) → Promise<true>
Like vars, but shared by your whole account: every element and the chatbot read and write the same keys. Goals, counters and timers can publish their value to a global (the "Publish value for other elements" option), and a chatbot command can set one (the "set a variable" action on the Chatbot page) so chat drives your visuals. Each get reads fresh, so read on events, not every frame. Elements can also react the moment a command fires:
// A chatbot command set to "send an overlay event" arrives as:
landmark.on("command", (ev) => {
  if (ev.payload.name !== "hype") return;   // !hype
  burst(ev.payload.user, ev.payload.args);
});
landmark.tts(text, opts?)
Read text aloud through your TTS. opts.voice is optional. On the live overlay it queues a read on your account, spoken and billed through your normal TTS. An AI voice is Landmark Usage, a standard voice is free. In the editor preview it does nothing, so previews never bill. Empty text is ignored. Use it for moments worth speaking (goal reached, a big tip), never for every chat line.
landmark.tts("We just hit the goal!", { voice: "Brian" });
landmark.translate(text, lang) → Promise<{ text, translated, detected }>
Translate text into the language code lang with Landmark's shared translator. The promise always resolves. When the translator cannot answer, or in the editor preview, it resolves to the original text with translated: false, so a chat element simply shows the original line.
const r = await landmark.translate("hola", "en");
line.textContent = r.text;   // "hello", or "hola" when it could not translate
landmark.sound  { url, volume, play(url?, volume?) }
The sound picked in the editor's Sound section. url is null when none is set. play() plays it at its volume, and play(otherUrl, volume) plays any other URL. It is silent in the editor preview. The editor's Test fire is how you hear it.
landmark.onClearChat(cb) → () => void
landmark.clearChat()
A chat element registers a handler with onClearChat, and clearChat() runs every handler, for example from a Skill that wipes the box. It only clears what this element drew. Nothing is deleted on the platform.
landmark.dismiss()
Close an alert before its duration_ms runs out. Do not call it from a persistent element.
landmark.redeems  { on(key, cb), available(key, open, { viewers, reason }), list() }
What viewers redeem in your element. Declare each one in the element's properties as _redeems. Saving the element puts it on your menu, at its price in coins, and the price you set on the Menu stays. Viewers redeem it like any other Skill. Use this for anything viewers pay to make happen in the element. A payment amount or a reward name is not a way to start it.
// In the element's properties:
// "_redeems": [{ "key": "boost", "label": "Marble boost", "coins": 50 }]

// Runs on every paid redemption.
landmark.redeems.on("boost", function (r) {
  // r = { key, label, user, user_login, text, coins, test, platform, viewer }
  speedUp(r.viewer);
});

// Only the racers can boost, and only while a race runs.
landmark.redeems.available("boost", racing, {
  viewers: racers.map(function (x) { return x.joinEvent; }),
  reason: racing ? "Only for racers in this race" : "Opens when a race starts"
});
available sets who can redeem it right now. viewers are events from landmark.on or { platform, user_id, user_login }, matched through accounts viewers linked, and left out for everyone. reason is the short line everyone else sees. Landmark refuses a Skill the element did not open, and the viewer is not charged. A Skill you only listen to is open to everyone while the element runs in OBS, and closed while it does not. r.viewer is the entry it matched: { p, id, l } (platform, user id, login). list() resolves to [{ key, label, coins, on }].

Settings (_schema)

_schema in the element's properties is a list of settings. The editor shows one control per entry under Style, grouped under small headings by group, and your code reads each value as landmark.config[id]. Placing the element on an overlay can override any value for that one placement.

{ id, label, type, default, min?, max?, step?, options?, group?, placeholder?, item? }
// key is accepted in place of id
color · number · slider · text · toggle
One value each. slider and number take min, max and step. A long text default gets a larger text box.
select
options is a list of { value, label } objects, and the default is one of the values.
platforms
A pick of the platforms to count. The value is an array of platform ids, default [] (all).
location
A place picker in the editor, for elements like weather.
list
Rows the streamer can add, remove and drag into order, for milestone ladders, prize lists and anything repeatable. item names the fields of one row, each { key, label, type } with type one of text, number, color or toggle. The value is an array of row objects keyed by those keys, in the order the streamer set. max caps the rows (at most 100). Use a list for anything repeatable, never one text setting split on commas. Older elements that keep a list in a text setting keep working.
// In the element's properties
"_schema": [
  {
    "id": "milestones",
    "type": "list",
    "label": "Milestones",
    "group": "Goal",
    "max": 20,
    "item": [
      { "key": "amount", "label": "Amount", "type": "number" },
      { "key": "title",  "label": "What happens", "type": "text" },
      { "key": "color",  "label": "Color", "type": "color" }
    ],
    "default": [
      { "amount": 50,  "title": "Wear the hat", "color": "#22c55e" },
      { "amount": 100, "title": "Spicy noodles", "color": "#f97316" }
    ]
  }
]

Live events

Every callback from landmark.on(), and every entry in landmark.events, is one event:

{
  platform:    "twitch" | "google" | "kick" | "rumble" | "tiktok" |
               "landmark" | "portal" | "game:<slug>",
  type:        see the event index below,
  usd_amount:  number | null,   // US dollars for money events, null otherwise
  occurred_at: "2026-06-25T12:00:00Z",
  payload:     { ... }          // depends on the type
}

platform is "google" for YouTube, "landmark" for Landmark itself (a cash tip, a referral join, a chatbot command) and "portal" for a coin tip or a portal Skill. Always guard for missing fields. Payloads vary by platform (a Twitch cheer has bits, a TikTok gift has diamonds). Fields marked with ? only come from some platforms.

Event index

Every type landmark.on() accepts. "Live" types reach any element on any source. The rest only arrive while their built-in element is placed on the same overlay (see status feeds).

TypePlatformsPayload fieldsDollarsArrives
chattwitch, google, kick, rumble, tiktokuser, user_login?, avatar?, color?, text, fragments?, badges?, orientation?noLive
followtwitch, google, kick, rumble, tiktokuser, user_login?, avatar?noLive
subscribetwitch, google, kick, rumble, tiktokuser, user_login?, avatar?, tier?, months?, member?, uniqueId?, userId?yesLive
gifttwitch, google, kick, tiktokuser, avatar?, gift_name?, amount?, total?, kind?, gift?yesLive
cheertwitchuser, user_login?, avatar?, amount (bits), powerup?yesLive
superchatgoogle, rumble, landmarkuser, avatar?, text, amount?yesLive
raidtwitchuser, amount (viewers)noLive
redemptiontwitch, kick, portaluser, reward, cost?noLive
tipportaluser, amount ("500 coins" string), amount_cents (the coin count), text, source, from_walletyesLive
viewerstwitch, google, kick, rumble, tiktokviewerCount, streamId?, totalUser?noLive
liketiktok, google, rumbleuser?, uniqueId?, userId?, avatar?, likeCount, totalLikes?, totalLikeCount?noLive
sharetiktokuser, uniqueId?, userId?, avatar?noLive
commentgoogleuser, text, sourcenoLive
stream_onlinetwitchstream_id, kindnoLive
stream_offlinetwitchnonenoLive
landmark_joinlandmarkusernoLive
commandlandmarkname, user, args (string[]), textnoLive
camera_filterlandmarkuser, filter_id, filter_name, emoji, kind, source, amount?, test?yesLive
captionlandmarktext, finalnoLive
irllandmarkat, lat?, lon?, acc?, speed?, heading?, dist_m?, steps?, kcal?, off?noLive
controllandmarktarget, verb, num?, value?, target_delta?, anchor?, paused?, frozen?, server_now?noLive
chat.purgelandmarkscope, messageId?, platform?, user?noLive
sound_playedlandmark, twitch, google, kick, rumble, tiktokurl, volume?, viewer?, label?yesLive
chest_fundlandmarkcoins, tiernoLive
chest_openlandmarktotal, winners ({ name, coins }[]), count, eligible, opened_by, chest_idnoLive
chest_winlandmarkuser, coins, textnoLive
game_actiongame:<slug>(whatever the mod sent)noLive
game_challenge_completegame:<slug>user, text, completions?noLive
game_challenge_resetgame:<slug>user, textnoLive
game_fish_scoredgame:<slug>user, textnoLive
game_fish_modegame:<slug>user, textnoLive
cameralandmarkactive_prompt, viewer, seconds_left, queued, capture_live, next_prompt, next_viewer, filters_active?, filters_queued?, rate_cents_per_sec?noNeeds Landmark Camera status placed
profitlandmarkrevenue_cents, cost_cents, net_centsnoNeeds Profit placed
schedulelandmarkitemsnoNeeds Schedule placed
redeemslandmarkredeems, currencynoNeeds Skills menu placed
polllandmarkpollnoNeeds Poll placed
giveawaylandmarkgiveawaynoNeeds Giveaway placed
minewithmelandmarkstatenoNeeds Mine With Me placed
tts_readinglandmarksource_event_idnoNeeds Chat box placed
media_sharelandmarkplaying, queue_len, up_next?, action?, viewer?, media_platform?, title?, test?yesNeeds Media share placed

chat

payload.user string
Display name of the chatter.
payload.text string
The message text.
payload.user_id · user_login string?
Platform user id and login when available. Twitch sends both, YouTube and Kick send user_id, TikTok sends userId and uniqueId.
payload.avatar · payload.color string?
The chatter's picture and name color, when the platform sends them.
payload.badges Array<{ type, img? }>?
Role badges. type is one of broadcaster, owner, mod, lead_mod, vip, sub, member. img is the real badge image when the platform sent one. Left out when there are no badges.
payload.fragments Array<{ type, text, id?, url?, gif? }>?
Only present when the message has emotes. type is "text" or "emote". An emote fragment carries an id or a ready url. A Twitch chat GIF is an emote fragment with gif: true and its url (show it larger than an emote). When absent, use text.
payload.is_mod · is_owner boolean?
YouTube flags (other platforms carry the same facts in badges).

After a page load the overlay replays up to the last 60 chat lines into on("chat"), so a chat box refills on its own.

follow

payload.user string · payload.user_id string?
Who followed. No usd_amount.

subscribe

payload.user string
Who subscribed or became a member.
payload.tier string?
Twitch tier ("1000", "2000", "3000") or the YouTube member level name.
payload.member boolean
true for a YouTube membership, false for a paid Twitch, Kick or Rumble sub.
payload.months · payload.streak · payload.milestone number?
Months so far, the streak, and the YouTube milestone month, on resubs and milestones.
payload.text string?
The resub or milestone message, when shared.
usd_amount number
What the streamer earns (Twitch Tier 1 about $2.50, Tier 2 $5.00, Tier 3 $12.50, a YouTube member, Kick or Rumble sub $4.99).

cheer (Twitch bits)

payload.user string · payload.amount number
Who cheered and how many bits.
payload.text string?
The cheer message.
payload.anonymous boolean
true for an anonymous cheer.
payload.bit_image · payload.bit_tier string? / number?
The cheermote image and its tier, when known.
usd_amount number
bits × $0.01.

superchat (YouTube Super Chats and Stickers, Rumble rants, Landmark cash tips)

On platform "landmark" a superchat is a Landmark cash tip. See tips below. Check e.platform when the difference matters.

payload.user string
Who paid.
payload.amount string
The amount as shown, for example "$5.00", "CA$10.00" or "₹1,000.00". usd_amount is the number.
payload.text string?
The message (absent on Super Stickers).
payload.currency · payload.tier string? / number?
Currency code and the YouTube Super Chat tier, when known.
payload.sticker true?
Present on a Super Sticker.
usd_amount number
Converted to US dollars at live rates.

gift (gift subs, sub bombs, TikTok and Kick gifts)

payload.user string
The gifter ("Anonymous" for anonymous Twitch bombs).
payload.kind "subscription" | "item"
"subscription" for gifted subs and memberships, "item" for a TikTok or Kick gift.
payload.total · payload.community number? / boolean?
How many subs were gifted, and whether it was a community bomb.
payload.tier · payload.anonymous string? / boolean?
Sub tier, and whether the bomb was anonymous (Twitch).
payload.giftName · diamonds · totalDiamonds · repeat (TikTok)
Gift name, diamonds per gift, combo total and final combo count (50 roses fire one event).
payload.gift { id, name, iconUrl, cost }?
Gift picture and cost for TikTok and Kick gifts, when known.
usd_amount number
Gift value in US dollars.

raid (Twitch)

payload.user string · payload.amount number
The raiding channel and how many viewers it brought. No usd_amount.

redemption (channel points and Landmark Skills)

payload.user · payload.reward string
Who redeemed and the reward name.
payload.input · payload.text string | null
What the viewer typed, when the reward asks for it.
payload.reward_id · payload.slug · payload.surface string?
The Twitch or Kick reward id, and the Landmark Skill slug and surface, so you can target one Skill across renames. To show it, that is all you need. For something viewers pay to make happen in your element, use landmark.redeems.
payload.cost · payload.status number? / string?
Channel point cost and status (Twitch).

like · share · viewers · comment

like (TikTok, YouTube, Rumble)
payload.likeCount is the new likes. TikTok adds payload.user and payload.totalLikes. YouTube and Rumble add payload.totalLikeCount and have no user.
share (TikTok)
payload.user, plus uniqueId and userId.
viewers (all platforms)
payload.viewerCount, refreshed every few minutes. Treat it as approximate.
comment (YouTube)
payload.user, payload.text. A video comment, not live chat.

tips (Landmark cash and coin tips)

Landmark tips reach your element as two different events. An element that reacts to tips has to handle both.

Cash tip: type "superchat" on platform "landmark"
payload.user, payload.amount as a string such as "$5.00", payload.text and payload.source ("tip-page"). usd_amount is the dollars.
Coin tip: type "tip" on platform "portal"
payload.user, payload.amount as a string such as "500 coins", payload.amount_cents (the coin count), payload.text and payload.from_wallet. usd_amount is the coins at one cent each.
function addTip(e) { /* e.usd_amount is the dollar value either way */ }
landmark.on("tip", addTip);                       // coin tips
landmark.on("superchat", (e) => {                 // cash tips
  if (e.platform === "landmark") addTip(e);       // skip YouTube Super Chats and Rumble rants
});

A tip alert has two triggers for the same reason: one for platform Landmark with the event superchat, one for platform Portal with the event tip. The editor's trigger list and the AI assistant set up the pair for you.

Landmark events

command · platform landmark
payload.name, user, args (string array), text. A chatbot command set to send an overlay event.
camera_filter
payload.user, filter_id, filter_name, emoji, kind, source, amount, test. A viewer applied an AR camera filter.
caption
payload.text and payload.final. A live caption line. final: true is a finished sentence.
irl
payload.at, and while sharing: lat, lon, acc, speed (metres per second), heading, dist_m, steps, kcal. off: true means the phone stopped sharing. Only element sources get it.
control
payload.target (your landmark.config._eid), verb (add, sub, set, reset, enabled) and the new state: value and target_delta for goals and counters, anchor, paused, frozen, server_now for timers.
chat.purge
payload.scope (message or user), messageId, platform, user. A mod removed a message or banned a user.
sound_played
payload.url, volume, viewer, label. A soundboard sound played. Landmark plays the audio, your element only shows a card.
landmark_join
payload.user. Someone joined Landmark through your referral link.
stream_online · stream_offline (Twitch)
payload.stream_id and payload.kind when the stream starts, nothing when it ends.
chest_fund · chest_open · chest_win
The Community Chest. chest_fund has coins and tier. chest_open has total, winners ({ name, coins } each), count, eligible, opened_by, chest_id. chest_win is one winner: user, coins, text.
game_action, game_challenge_complete, game_challenge_reset, game_fish_scored, game_fish_mode · platform game:<slug>
From a game mod. game_action carries whatever the mod sent. The named milestones also carry user and text.

Status feeds that need a built-in element

A few events are not part of the live feed. The overlay page asks Landmark for them on a timer and pushes the answer into your element, and it only does that while the matching built-in element is placed on the same overlay. A custom element on its own browser source, or on an overlay without that built-in, never gets them, in OBS or in the editor preview.

  • camera: Landmark Camera status, every 3 seconds. Needs the Landmark Camera status element.
  • media_share now-playing status, every 3 seconds. Needs the Media share element. The queue actions (queued, started, finished, rejected) arrive without it.
  • tts_reading: the chat line being read aloud. Runs while a chat element has its highlight option on.
  • profit, schedule, redeems, poll, giveaway, minewithme: each belongs to its built-in element, and their shapes can change. Add the built-in instead of rebuilding it. poll and giveaway also arrive on the live feed when they change, as the bare snapshot, but there is no first snapshot without the built-in.

Goals, counters and timers

A goal bar, counter or timer is a meter. Give the element that kind, set display_only: true in its properties, and the server counts every event, runs chat commands, the dock and rules, and pushes the result to your code. Your code never counts and never writes the value.

  • Read the starting value on mount with landmark.vars.get: progress and target_delta for a goal, value for a counter, anchor, paused, frozen and _server_now for a timer (epoch seconds).
  • Apply control events whose payload.target equals landmark.config._eid.
  • A goal declares settings with the ids goal, title and metric. Milestones belong in a list setting.
  • Progress is kept per placement, so the editor's Variables panel stays hidden for a meter. Use the Current total section or the Goals page to set it.

Your menu and other account data

landmark.data.get(kind) reads data you already show in public, for the account the overlay belongs to. The page around the element does the read, so the element still never touches the network. It always resolves: the data, or null when it is not available (unknown kind, a signed-out preview, an error, or no answer within 10 seconds). landmark.data.kinds lists the kinds. Nothing here carries a wallet, an email, a viewer account id, a Skill id or a cash balance, and nothing here can fire a Skill.

landmark.data.watch(kind, cb, everyMs) calls cb with the first answer and again whenever it changes. It reads again every 15 seconds by default and never faster than every 5. It returns a function that stops watching. Use it for anything that should follow your menu: a new price, an item switched off, stock running out, the stream going live.

"redeems" is your real menu, the same one viewers see on your page, in the same order. It works the same on the live overlay, in the editor preview, on its own as a browser source, and on the phone and desktop apps. Items you paused or hid are never in it. Each item says whether a viewer can redeem it right now, so a menu element can show what is on offer and dim the rest while you are offline.

"owed" is your custom Skills, the ones you do by hand, with how many are left and who you still owe one, in the order they came in. Someone who redeemed it twice is one row with a count of 2. Marking one done on your Menu or in the dock takes it off the list.

KindShapeWhat it is
redeems{ live, count, groups: string[], redeems: { label, description, kind, group, icon, image_url, color, coins, usd, price_text, unit, available, note, stock_left, stock_total, sold_out }[] }the streamer's real menu: everything a viewer can redeem on Landmark, in the portal's order (grouped, cheapest first inside a group). live is whether the stream is live. count is how many can be redeemed this second. groups is the group names in order ("Custom", "On stream", "Camera", "Media and voice", "Games", "Lights and plugs", "Other"), and group on each item is the one it sits in. icon is an emoji, image_url a picture or null. coins is the coin price (1 coin = 1 cent) and usd the same price in dollars, null when it has no Landmark price. price_text is the price the way the menu says it ("100 coins or $1", "5 coins a second"), null when there is none. unit is "per second" or null. available is true when a viewer can redeem it right now (live, the game running, the overlay or Desktop open), and note says when it can be when it cannot ("when live"). stock_left and stock_total are numbers on a Skill with limited stock ("12 left", "12 of 20 left") and null when it has no limit. sold_out is true when the stock ran out, and available is then false. Items the streamer paused or hid are never in it
owed{ items: { label, coins, stock_left, stock_total, sold_out, paused, owed_total, owed: { name, count, since }[] }[] }the streamer's custom Skills (the ones done by hand, like a sticky note on the wall) and who is still owed one. One item per custom Skill that is switched on, oldest first. label is its name and coins its coin price (1 coin = 1 cent, the same as a tip in dollars). stock_left and stock_total are numbers when it has limited stock and null when it has no limit, sold_out is true when none are left. owed_total is how many are owed in all, and owed is who: one row per name in the order they came in, count is how many that name is owed (2 or more when they redeemed it again), since is when the oldest of theirs came in. One drops off the list when the streamer marks it done. Names are the ones the alert showed, an anonymous tip is "Anonymous"
// A menu slideshow: one item at a time, always your real menu.
const box = document.getElementById("slide");
let items = [];
let index = 0;

// Draw the current item, or one line when nothing is on offer.
function show() {
  if (!items.length) {
    box.textContent = "Menu opens when the stream is live";
    return;
  }
  const item = items[index % items.length];
  box.textContent = item.icon + " " + item.label + "  " + (item.price_text || "");
  box.style.opacity = item.available ? "1" : "0.5";
}

// Follow the menu. A new price or a sold out item shows up on its own.
landmark.data.watch("redeems", (data) => {
  if (!data) return;   // could not read it, keep what is shown
  const open = data.redeems.filter((r) => r.available);
  items = open.length ? open : data.redeems;
  show();
});

// Next item every few seconds.
setInterval(() => {
  index += 1;
  show();
}, 4000);

Limits

  • No network: no fetch, no XMLHttpRequest, no storage or cookies. Images, fonts, audio and scripts by URL do load.
  • HTML, CSS and JS: up to 200,000 characters each.
  • landmark.events keeps the newest 200. The chat replay after a load is up to 60 lines.
  • vars and globals: keys up to 60 characters, each value up to 8,000 characters once saved as JSON, up to 200 keys per element.
  • landmark.tts: 600 characters per read, the live overlay only, up to 10 reads every 20 seconds per account.
  • landmark.translate: the first 800 characters, up to 600 a minute per account.
  • A list setting keeps up to 100 rows. A shared element carries up to 60 settings and 100 saved values.
  • landmark.data: refreshed every 5 seconds, up to 240 reads a minute per overlay, 10 seconds before it resolves to null. watch reads at most every 5 seconds.

Built-in sounds

These ship with Landmark and are free to use with new Audio() or landmark.sound.play(url):

  • /sounds/elements/confetti.mp3: celebratory pop
  • /sounds/elements/wheel-spin.mp3 · /sounds/elements/wheel-win.mp3: spin and win
  • /sounds/elements/goal-reached.mp3: goal chime
  • /sounds/elements/counter.mp3: short blip

Audio plays on the live overlay and is silent in previews. Some browsers only allow audio after the overlay's first interaction, which is fine for plays driven by events. Add a sound on/off toggle to _schema so streamers can mute.

Example: a milestone ladder

A persistent goal-style element that reads the milestones list setting above, keeps a running total of tips in landmark.vars, and shows the next few milestones. Each row stays one milestone, so sorting never mixes up amounts and titles.

const c = landmark.config || {};
const box = document.getElementById("ladder");

// The rows the streamer set, cheapest first.
const rows = (Array.isArray(c.milestones) ? c.milestones : [])
  .filter((r) => r && Number(r.amount) > 0)
  .sort((a, b) => Number(a.amount) - Number(b.amount));

let total = 0;

// Draw the next three milestones above the total.
function render() {
  box.innerHTML = "";
  const next = rows.filter((r) => Number(r.amount) > total).slice(0, 3);
  for (const r of next) {
    const line = document.createElement("div");
    line.textContent = "$" + r.amount + "  " + (r.title || "");
    line.style.color = r.color || "#fafafa";
    box.appendChild(line);
  }
}

// Count both kinds of Landmark tip.
async function addTip(e) {
  total += Number(e.usd_amount) || 0;
  await landmark.vars.set("total", total);
  render();
}

// Start from the saved total, then listen.
landmark.vars.get("total").then((v) => {
  total = Number(v) || 0;
  render();
});
landmark.on("tip", addTip);
landmark.on("superchat", (e) => {
  if (e.platform === "landmark") addTip(e);
});

Example: a chat box

Listens with landmark.on("chat") and honors a "max messages" setting. After a page load Landmark replays the last chat lines into the same handler, so the box refills without any extra code.

const box = document.getElementById("box");
const MAX = (landmark.config && landmark.config.max) || 30;

function render(e) {
  const p = e.payload || {};
  const row = document.createElement("div");
  row.textContent = (p.user || "?") + ": " + (p.text || "");
  box.appendChild(row);
  while (box.children.length > MAX) box.removeChild(box.firstChild);
  box.scrollTop = box.scrollHeight;
}

// Recent lines are replayed here after load, then it stays live.
landmark.on("chat", render);

← Back to Elements · Elements & overlays → · TTS reference →

Last updated · October 19, 2026

window.landmark API · Landmark