Loading MatchX game as part of your website

MatchX game can be shown as a separate page on your main website

You need to create an empty IFRAME element and set it specific to your design height and width styles.

As soon as the player is authorized you can make a JavaScript call

_smartico.miniGame(362, { 
    iframe:'match-x-game',
    zoom: 1,
    height: 'auto'
});.
  • The first argument is the ID of the MatchX game template (you can have multiple).

  • The second argument is a set of parameters:

    • iframe - id of the IFRAME element, where the game will be shown.

    • zoom - optionally gives a possibility to zoom in/out the UI of the game

    • height - can be set to 'auto' or to fixed height in pixels, e.g. '500px'. It's recommended to set the value to 'auto' for desktop users and to the fixed height on mobile devices. This approach will provide the best UX.

Example of the HTML/JavaScript code

<iframe id='match-x-game' style='width: 100%; height: 0px; display: none'>
</iframe>
<script>
    _smartico.miniGame(362, { iframe:'match-x-game', zoom: 1, height: 'auto'} );
</script>

Please note that if the 'width' of the div is 576px or less, the rendered UI will be adjusted for mobile devices.

Please note that at the time of the call to smartico.miniGame, the Smartico script should be already loaded. Otherwise, you will get an exception that _smartico is undefined.

If you don't have good control from the JavaScript when _smartico script is loaded, you can use the code below to trigger the game without exception.

<script>
var miniGameInterval = setInterval(function() {
    if (window._smartico && document.getElementById('match-x-game')) {
        _smartico.miniGame(362, { iframe:'match-x-game', zoom: 1, height: 'auto'} );
        clearInterval(miniGameInterval);
    }
}, 10)
</script>

You can see more examples of embedding MatchX and other gamification components on this demo page:

https://demo.smartico.ai/tests/landing-demo-inline-w.html

Last updated

Change request #417: