> For the complete documentation index, see [llms.txt](https://help.smartico.ai/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.smartico.ai/welcome/products/vibe-studio/widgets.md).

# Widgets

A **Widget** is a drop-in gamification block you build in Vibe Studio and embed **anywhere on your existing website** - a leaderboard in the lobby sidebar, a missions strip across the top of the sports page, a badge wall on the account screen. You design the look; the live data flows in from Smartico.

<div><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-925eae89b7835fb1905ef65eb1ae7d24998794ff%2FSmartico%20%E2%80%94%20Promo%20Page%202026-06-29%2017-18-36.png?alt=media" alt="" width="563"><figcaption></figcaption></figure> <figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-ca8abe37f8c1b0f1b76d597d0ace446c4778464b%2FSmartico%20%E2%80%94%20Promo%20Page%202026-06-29%2017-17-36.png?alt=media" alt="" width="563"><figcaption></figcaption></figure> <figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-dac8e3bd6f7e8cfd2a5a9e7d0b85a4fbba3c0f45%2F0cbb168f59-crop-3-5cfdd4e5-cccba5.png?alt=media" alt="" width="563"><figcaption></figcaption></figure> <figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-78c3e5f53c2f7c8b35c753f4cf4e37fdbb942ca7%2F9fc08935d1-crop-4-78257123-2ff547.png?alt=media" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" icon="bell" %}
**Check examples of the widgets, landings, promotions, and custom games on** [**https://smartico.dev**](https://smartico.dev/)
{% endhint %}

### When to use a widget

Use a widget when you want gamification **inside your existing product**, rather than on a separate page. Widgets run for **logged-in players**, so they show each player's own missions, balances, level, and rewards out of the box.

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-368c288e70550104d09fc57916fa1b0d1032870a%2FSmartico%20%E2%80%94%20Promo%20Page%202026-06-29%2017-26-26.png?alt=media" alt=""><figcaption><p>Inbox &#x26; Tournaments widget placed on the product site</p></figcaption></figure></div>

### What you can put in a widget

Almost any Smartico mechanic: [**Missions**](https://help.smartico.ai/welcome/products/gamification-basics/missions.md), [**Levels**](https://help.smartico.ai/welcome/products/gamification-basics/levels.md), [**Tournaments**](https://help.smartico.ai/welcome/products/gamification-basics/tournaments.md), **Leaderboards**, [**Store**](https://help.smartico.ai/welcome/products/gamification-basics/marketplace.md), [**Avatars**](https://help.smartico.ai/welcome/products/gamification-basics/avatars.md), [**Badges**](https://help.smartico.ai/welcome/products/gamification-basics/badges.md), [**Activity Log**](https://help.smartico.ai/welcome/products/gamification-basics/activity-log.md), [**Inbox**](https://help.smartico.ai/welcome/products/crm-automation/communication-channels/inbox.md), [**Raffles**](https://help.smartico.ai/welcome/products/gamification-basics/raffles.md), [**Jackpots**](https://help.smartico.ai/welcome/products/gamification-basics/jackpots.md), [**Clans**](https://help.smartico.ai/welcome/products/gamification-basics/tournaments/clans-and-clan-tournaments.md), or several blended into one surface. Vibe Studio builds the *presentation*; for how each mechanic itself works, see its own Help Center article.

### How a widget reaches the player

A widget is a small JavaScript bundle hosted by Smartico (on the widgets domain). You don't link to it; you **embed** it. The host page mounts it into a `<div>`, and the widget reads the logged-in player, the label/brand keys from the **Smartico SDK that is already running on that page**. That is the one prerequisite: the page you embed on must already initialize the Smartico SDK (the standard `_smartico.init(...)` integration your site uses for popups, missions, etc.). Because the Smartico SDK already knows the player and the label, a widget needs **no per-player parameters** - identity comes from the host page.

### Publishing and embedding (step by step)

* **Create.** Go to **Vibe Studio → Widgets** and click **Create**. Pick a template, enter a name and click **Use this template**. On the widget's page, click **Open for Editing** to open the Studio.
* **Publish.** In the Studio toolbar, click **Publish**, then confirm in the **Publish this widget?** dialog. This builds the widget and pushes it live to the CDN.

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-b20de80fc2f4a571ceabf4eee5341e52878017d7%2FMulti-Masters%20%5C%20smartico.ai%20%40%20EU2%202026-06-29%2021-17-52.png?alt=media" alt=""><figcaption></figcaption></figure></div>

* **Get Code opens automatically.** After a successful publish, the **Get Code** pop-up opens with your embed snippet. (You can also open it any time from the toolbar button to the left of Publish.)

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-c7de8b144a03615cb3e8109fe935c7f1c442a5b0%2FMulti-Masters%20%5C%20smartico.ai%20%40%20EU2%202026-06-29%2021-20-06.png?alt=media" alt=""><figcaption></figcaption></figure></div>

* **Set the layout first (optional).** Open **Widget Layout** (the button next to Get Code) to choose:

  * **Container width** and **Container height** - **Auto** (width fills the space, height grows with the content), or **Fixed** in pixels.
  * **Fit** - **Content** (the widget sizes to its own content) or **Fill** (it fills the container you give it).
  * **Background** - the colour behind the widget in the preview, so you can match your site. It is not part of the embed code.

  <div align="center" data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-a2f4ee52bbee2b79bc1e2213bef10c58fbf6d104%2FMulti-Masters%20%5C%20smartico.ai%20%40%20EU2%202026-06-29%2021-21-27.png?alt=media" alt=""><figcaption></figcaption></figure></div>
* **Copy the snippet.** It looks like this:

```html
 <div id="smartico-gamification-block" style="width:100%"></div>
 <script>
   _smartico.gamificationBlock({
     dom_id: 'smartico-gamification-block',
     url: 'https://<your-widgets-domain>/.../widget/widget.js',
     fit: 'content',
   });
 </script>
```

* The `<div>` is the placeholder where the widget mounts; its `style` carries your container size (fixed width gives `width:Npx`, otherwise `width:100%`; a fixed height adds `height:Npx;overflow:auto`).
* `_smartico.gamificationBlock({ ... })` mounts the widget. `dom_id` matches the placeholder, `url` points to your published widget bundle, and `fit` is your Widget Layout choice.

> **Tip:** Re-publish whenever you make changes - the embed `url` stays the same, so you don't have to touch your site again; the new version propagates from the CDN. A player's browser can keep the old version for up to an hour.

### When your site removes the widget

On a single-page site (React, Vue, Angular and others), moving to another screen often removes the widget's `<div>` from the page without a page reload. The Smartico SDK notices this and stops the widget: its timers and its requests to Smartico end. You don't need to call anything.

By default, the widget keeps running for 30 seconds after its `<div>` leaves the page:

* If the same `<div>` comes back within that time (for example, your site keeps the screen in memory and shows it again), the widget is just as the player left it.
* If it comes back later, the widget loads again from the start.
* A new `<div>` with the same id gets the widget only from a new `_smartico.gamificationBlock` call, as on the first visit.

Calling `_smartico.gamificationBlock` again with the same `dom_id` replaces the widget in that `<div>` at once.

To change the 30 seconds, add `keep_alive_sec` to the call:

| `keep_alive_sec`    | What happens after the `<div>` leaves the page                                        |
| ------------------- | ------------------------------------------------------------------------------------- |
| not set             | The widget stops after 30 seconds.                                                    |
| `0`                 | The widget stops at once (within about a second).                                     |
| a number of seconds | The widget stops after that many seconds.                                             |
| `Infinity`          | The widget never stops. Use it only if your site always shows the same `<div>` again. |

```html
 <script>
   _smartico.gamificationBlock({
     dom_id: 'smartico-gamification-block',
     url: 'https://<your-widgets-domain>/.../widget/widget.js',
     fit: 'content',
     keep_alive_sec: 0,
   });
 </script>
```

A negative value or a value that is not a number is refused: the widget is not shown, and the browser console shows an error.

### If your widget is about one specific thing

Some widget templates are built around a single entity (one specific tournament, raffle, mini-game, or matchx/quiz template).

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-da53fad708f739f6199c9eb6f62fc6c201d68296%2FMulti-Masters%20%5C%20smartico.ai%20%40%20EU2%202026-06-29%2021-23-08.png?alt=media" alt=""><figcaption></figcaption></figure></div>

Those declare an **extra field** - a picker in the toolbar where you choose which entity to show. Your choice is baked into the embed `url` as a query parameter, so the published widget shows the right one.

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-a8d813af50e6ff97a0a116f7632fa105ecf94edb%2FMulti-Masters%20%5C%20smartico.ai%20%40%20EU2%202026-06-29%2021-25-12.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Check it before you embed

Run **`/verify`** in the chat for a general review, then **`/widget-check`** - it audits the widget for anything that could escape its box or affect the host page's styles, and can fix it (`/widget-check fix all, don't ask`). This matters because a widget runs inside someone else's page.

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-a81c94e42d3fe36c2b34919641d6402e5f9918c9%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Examples to ask the assistant for

* "A weekly leaderboard, top 10, with the current player's row highlighted and a countdown to reset."
* "A missions strip showing the three missions closest to completion, with progress bars."
* "A badge showcase grid for the player's account page."

### FAQ

**The widget shows nothing on my site.** The host page must already run the Smartico tracker (`_smartico.init`). Paste the snippet after that init, and make sure the `dom_id` in the snippet matches the `<div>` id. Inside the Studio, an empty preview just means you haven't picked a **Preview user** in the toolbar yet.

**Where is the widget hosted?** On the Smartico widgets domain; the published bundle is the `url` in your snippet. Your page stays in control of where it sits and how big it is (via the `<div>` style / Widget Layout).

**Will it break my site's styling?** No - a widget is isolated from the host page. And AI is instructed explicitly to keep styles isolated. Still, run `/widget-check` before embedding to catch anything that could leak to the main page.

**How do I make it match my brand?** Set your label's brand rules once, and the assistant follows them on every build - see [Brand rules for your label](https://help.smartico.ai/welcome/products/vibe-studio/working-with-the-ai-assistant.md#brand-rules-for-your-label). The **Label branding** button on the widget's page in the Back Office opens this setting. You can also attach a screenshot or a Figma frame.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.smartico.ai/welcome/products/vibe-studio/widgets.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
