> 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/mini-games/mini-games-on-the-landing-pages.md).

# Mini-games on the landing pages

{% hint style="info" %}
The Visitor API and Mini-games for visitors require additional configuration to function correctly. Please see the guide below
{% endhint %}

Mini-games can work for anonymous users visiting your landing pages before completing registration.

You can display the Loyalty Wheel, Scratch & Catch, GiftBox, and most other games on your landing pages. After playing the game and completing registration, the user will receive a prize according to the prize pool definition.

Before you proceed with the setup of the mini-games, read the article about enabling [Visitor mode](/welcome/technical-guides/front-end-integration/visitor-mode.md) and placing the proper script on the landing pages

### Prerequisites: Dedicated test player account

Visitor mode operates by proxying gamification content through a dedicated test player account. Before launching a visitor mini-game:

* Create a dedicated player account on your platform for each brand associated with your landing pages. This account must be used exclusively for visitor mode and never for real gameplay, deposits, or promotions.
* Provide the player external ID to your Customer Success Manager or configure it in Brand Settings under Gamification so that visitor mode is enabled.
* Ensure the test player is added to any segments required to access the gamification content.

{% hint style="warning" %}
Important.

Smartico supports two modes to run mini-games for anonymous users.

1. The current page explains the setup of the game in your main "retention" label, with the possibility to issue prizes after the user completes registration
2. Another approach is to set up games under the Acquisition label, where prizes cannot be transferred after registration, but you can still use Popups and Push notifications for anonymous users.
   {% endhint %}

## Setting up the game template in Smartico BackOffice

You need to create a mini-game template specifically for Visitor mode by selecting the **Visitor mode** category in the Mini Games creation wizard in the Back-Office, and define the prize pool the same way as for real users.

<div><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-310270c0745b4184be4a80f77138f63fee5ca5b4%2FScreenshot_48.png?alt=media" alt=""><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-e713aba81ee5081b0009b55a72e8410a1965f791%2FScreenshot_49.png?alt=media" alt=""><figcaption></figcaption></figure></div>

After creating a template, take the template ID and use it on the landing page as described below

**Display the game on the&#x20;**<mark style="color:red;">**landing page**</mark>**, add the following JavaScript to execute and show the game:**

```javascript
<script>
_smartico.showVisitorGame({ 
    template_id: 12345,
    onWin: function(prize) {
        window.location.href = 'https://my-casino.com/index.html?_smartico_visitor_win_uuid=' + prize.visitor_win_uuid;
    }
});
</script>
```

* Set `template_id` to the ID of the mini-game template set up in the Smartico BackOffice
* Define the `onWin` callback function and retain the value of `prize.visitor_win_uuid`, which should be passed to your main site after the user completes the registration

{% hint style="warning" %}
`_smartico.initVisitorMode` must be called with your label key and brand key before calling `_smartico.showVisitorGame`. Calling `showVisitorGame` prior to initializing visitor mode will fail to render the mini-game.
{% endhint %}

{% hint style="info" %}
You can choose how to preserve the value and pass it to the main site, such as using cookies, passing it as a URL parameter, or saving it during the registration flow and retrieving it later on the main site.
{% endhint %}

**Setting a position for the mini-game**

By default, the mini-game is opened in the center of the screen as a modal overlay.

You can optionally position the mini-game in a specific place on the page, rather than as a modal.

For this, you need to define an iframe with the required dimensions and position, and instruct the script to load the game within it.

```javascript

<iframe style="width:300px;height:300px" id="myframe"></iframe>

<script>
_smartico.showVisitorGame({ 
    template_id: 12345,
    frame_id: 'myframe'
});
</script>
```

**Setting up Smartico scripts on the&#x20;**<mark style="color:red;">**main**</mark>**&#x20;site.**

When the user completes registration and is redirected to the main site, you need to transfer visitor\_win\_uuid to the main site.

**1st option** is just to pass it as a query parameter to the main site. .e.g

```javascript

 window.location.href = 
  'https://my-casino.com/index.html?_smartico_visitor_win_uuid='
  + prize.visitor_win_uuid;
                
```

**2nd option**, you are transferring the value in any way you prefer, but on the main site, you will need to set it in the global variable, like this.

```javascript
<script>
    window._smartico_visitor_win_uuid = '667018dc-b158-45b4-b52b-12f3a4a7175c';
</script>
```

### Completing prize conversion on the main site

Once the user completes registration and logs in on your main site, Smartico automatically detects the user session and converts the win identifier into the won prize on the new player account.

Alternatively, you can:

* Save the identifier in browser local storage under the key `_smartico_visitor_win_uuid`, which the Smartico script reads automatically upon user identification.
* Explicitly trigger conversion by calling `_smartico.convertVisitorGame(visitor_win_uuid)` in your front-end code once the player is identified.

**Extended possibilities on the&#x20;**<mark style="color:red;">**landing**</mark>**&#x20;page**

You can get more details about the won prize using the following code:

```javascript
<script>
_smartico.showVisitorGame({ 
    template_id: 12345,
    onWin: function(prize) {
        console.log('Prize ID', prize.id);
        console.log('Prize name', prize.name);
        console.log('Win UUID', prize.visitor_win_uuid);
    }
});
</script>
```

You can prevent the user from playing the game until they complete some steps in the registration process:

```javascript
<script>
var visitorEmail = undefined;

_smartico.showVisitorGame({ 
    template_id: 12345,
    onWin: function(prize) {
        console.log('Prize ID', prize.id);
        console.log('Prize name', prize.name);
        console.log('Win UUID', prize.visitor_win_uuid);
    },
    onBeforePlay: function() {
        if (!visitorEmail) {
            visitorEmail = prompt('Please enter your email', '');
            if (!visitorEmail) {
                return false;
            }
        }
        return true;
    },
})
</script>
```

The onBeforePlay callback should return true or false, indicating if a visitor is already allowed to play the game or still needs to pass some steps in the registration process.

**Show the game immediately when a visitor opens the landing page**

If you want to show the game immediately when the landing page opens, place the script in the correct order, as in the example.

```javascript
<script>
(function(d, r, b, h, s){h=d.getElementsByTagName('head')[0];s = d.createElement('script');s.onload=b;s.src=r;h.appendChild(s);})
(document, 'https://libs.smartico.ai/smartico.js', function() {
    _smartico.initVisitorMode('_label_key_', { brand_key: '_brand_key_', lang: 'DE' });
    _smartico.showVisitorGame({ 
        template_id: 12345,
        frame_id: 'myframe'
    });
});
</script>
```

## FAQ

**Q: Does the Visitor mode require additional configurations?**

A: Yes, the Visitor mode requires additional configurations that should be done by Customer Success Managers. If you have a multi-brand solution, this setup should be done for all brands associated with your landing pages. You should create and provide a test user ID - this test user should be used only for this.

**Q: What type of test user should be created?**

A: You must create a real player account on your casino or sportsbook platform (not a Back-Office user). This user acts as the proxy for anonymous visitors. It must be dedicated exclusively to visitor mode and should never be used for real bets, deposits, withdrawals, or regular testing.

**Q: Is there abuse protection for multiple wins in the game engine?**

A: Yes, the game's engine has abuse protection for multiple wins. Once a visitor plays a game on the landing page and receives a prize after registration, they won't receive additional prizes if they play the visitor game again.

**Q: Can the MatchX game run for the visitor?**

A: MatchX is not supported in visitor mode. It is still possible to provide it to non-registered users, but it will require creating separate labels and additional configuration. If you are interested, please contact your Customer Success Manager.

**Q: Which mini-games are supported in Visitor mode?**

A: Visitor mode supports Spin A Wheel, Scratch & Catch, GiftBox, Treasure Hunt, Voyager, Plinko, Coin Flip, and Custom mini-games. Games that require persistent player predictions or calendar states, such as MatchX, Quiz, and calendar Lootboxes, are not supported in visitor mode.

**Q: How are items deducted from the prize pool?**

A: The items in the prize pool are fixed and are not depleted when won by players.

**Q: How do we prevent visitors from playing the game multiple times?**

A: You can put a cookie or localStorage value in the user's browser in the onWin callback. Verify the value on the next visit, and don't show the mini-game if the value is set. Smartico doesn't have any logic to prevent the visitor from playing the game multiple times.

**Q: Can I host visitor mini-games on landing pages built with Vibe Studio?**

A: Yes. You can create landing pages in Vibe Studio (under Landings) and embed the visitor mini-game script into your page layout. You can also build Custom mini-games in Vibe Studio and configure them as visitor-mode templates in the Back-Office.

**Q: Can we give multiple attempts for the visitor to play?**

A: Smartico has no restrictions on how many times a specific visitor can play the game. If you want to apply limitations, do so using the operator's custom logic defined on the landing page.

**Q: What happens if existing users who registered a long time ago play in the visitor game and win the prize?**

A: There is a protection that will not issue prizes to players who play "visitor" games after they registered.

**Q: Does a visitor have a time limit to register and claim their won prize?**

A: No. There is no expiration time for a legitimate new visitor to register and claim their prize. A visitor can spin the game on a landing page and register hours or days later; as long as the spin occurred before account registration, the prize will be converted upon registration. The 1-hour limitation only applies in reverse: players whose accounts were registered more than 1 hour before playing the visitor game cannot claim visitor prizes, preventing existing users from farming rewards.


---

# 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/mini-games/mini-games-on-the-landing-pages.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.
