Level up. Article complete. One snippet, as many campaigns as you like.
Engineering Embedding

Why your snippet points to a channel, not a game

Paste the embed once. Swap the wheel for a quiz from the dashboard, with no code change and no redeploy.

The first version of almost every embeddable widget works the same way. You pick the thing you want to show, copy its id into a snippet, and ship the snippet. It works fine until marketing wants to change the thing. Then someone opens a ticket, a developer swaps the id, and the change waits for the next release.

For games that is a bad fit. Campaigns are short. A spin wheel for a launch weekend, a quiz for a product week, a prediction for a final. If each one needs a code change, the site team becomes the bottleneck for every campaign, and campaigns start late.

So a Keliplay snippet doesn’t name a game. It names a channel.

What a channel is

A channel is a spot on your site or in your app where games appear. The snippet is pasted there once and then left alone:

import { mount } from '@keliplay/sdk-web'

mount('#game', { channelId: 'chn_summer', clientToken })

Campaigns take turns behind that channel. Each campaign is one game for its whole life, with its own branding, prizes and limits. Changing the game means putting a different campaign on the channel. Nothing about the snippet changes.

What happens when the page loads

The embed is a small script, well under 2 kB gzipped, with no framework. When it loads, it asks one question: what is live on this channel right now?

  • If a campaign is live, the player goes straight to its pre-game page.
  • If nothing is live, the channel shows its between-campaigns panel. That is your own title, text and image, set on the channel. Out of the box it says “Nothing running just now” and “Check back soon.”

The answer only ever describes what is live now. Campaigns scheduled for later stay private until their turn, so nobody can peek at next month’s prize by reading network requests.

Taking turns on a schedule

Each campaign has a live-from and a live-until time. Leave either one empty and that end stays open. Put three campaigns on a channel with back-to-back windows and they hand over on their own, one after another, without anyone logging in at midnight.

Two campaigns on the same channel can’t overlap. That isn’t a dashboard warning you could click past; the database refuses it. There is never a moment where a player could land on either of two games depending on timing.

The part your backend does

Your server mints the player token with its API key, passing the channel and your own id for the player. Keliplay works out which campaign is live and issues a token for it. If nothing is live, you get a normal response with no token and the channel’s between-campaigns content, so you can handle the quiet periods however suits your page.

That same player id is what play limits count against, and it is what comes back in every webhook. You never need to map a Keliplay user to one of yours, because there isn’t a Keliplay user.

A few rules worth knowing

  • A campaign that has been played can’t be moved to another channel. Its history belongs to the place it ran.
  • A channel that still has campaigns can’t be deleted. Archive or move them first.
  • Webhook endpoints can be scoped to a channel, and they follow whatever campaign is live on it.

The result is a split that suits both teams. Developers paste one snippet per placement and stop thinking about it. The people running campaigns plan them in the dashboard, on their own schedule.

Keep reading