For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

▪️Player profile and gamification UI

Use these calls of the Smartico script to read the player's public profile (level, points, unread messages), to change the avatar, nickname and skin, to open the Gamification and Inbox widgets, and to check segments from the front end.

User profile details

As soon as the user is logged in, you can get user profile details, such as avatar, current level, gems, diamonds and points balance, and present this information on your site

_smartico.on('props_change', function(props) {
    if (props.avatar_id !== undefined) {
        console.log('Avatar URL', props.avatar_id);
    }
    if (props.ach_points_balance !== undefined) {
        console.log('Points balance', props.ach_points_balance);
    }
    if (props.ach_diamonds_balance !== undefined) {
        console.log('Diamonds balance', props.ach_diamonds_balance);
    }
    if (props.ach_gems_balance !== undefined) {
        console.log('Gems balance', props.ach_gems_balance);
    }        
    if (props.ach_points_ever !== undefined) {
        console.log('Points ever-balance', props.ach_points_ever);
    }    
    if (props.ach_level_current !== undefined) {
        console.log('Level name', props.ach_level_current);
    }
    if (props.core_inbox_unread_count !== undefined) {
        console.log('Unread messages', props.core_inbox_unread_count);
    }
    if (props.ach_gamification_in_control_group !== undefined) {
        // Flag indicating of gamification is enabled/disabled for user (true if disabled)
        console.log('Gamification status', props.ach_gamification_in_control_group);
    }    
    if (props.core_registration_date) {
        console.log('User profile is ready, core_profile_ready was triggered');
        console.log('This is indication that user profile is updated also from server-to-server integration');
    }
    
});

// You can also get the current set of properties at any moment using the following method
console.log('props of user', _smartico.getPublicProps());

Hiding gamification for the control group

You can hide gamification tools from a limited percentage of the users using the Gamification control group (the Gamification control group, % setting in Label settings; a brand can override it).

For example, you can set it to 10%; in this case, gamification will be disabled randomly for 10% of newly registered users: they are put in the control group. Users who already exist are not changed.

You can use a user property "ach_gamification_in_control_group" to segment users to whom gamification is disabled and use it on the front end to hide an entry point to the Gamification widget.

For a user in the control group, deep links that open the Gamification widget (for example dp:gf) do nothing. The same happens when Disable missions and gamification UI for this brand is on.

Example of the JavaScript code to expose the gamification widget only for users not in the control group.

Setting avatar

You can set the custom avatar as a PNG image with a 1x1 proportion for logged-in users.

Setting nickname

You can set the custom nickname for the user, the way he will be visible in the leaderboards and tournaments

Gamification: set skin using JavaScript API

There is a way to set the Gamification widget skin using JavaScript API

There are two possible cases we have got from clients.

If you have Day and Night visual schemes for your website, you may want to use two different Gamification skins depending on the UI of the main site.

Another case is when you want to give some users special skins, for example, based on the achieved level.

The skin names in these examples are placeholders. Use the skin names that Smartico set up for you.

Gamification widgets

The most flexible way to show gamification on your site is to build your own widgets in Vibe Studio. You describe the widget in the chat, and the AI builds it in your own design: a leaderboard in the lobby sidebar, a missions strip on the sports page, a store or a badge wall on the account screen. The widget shows the player's live data from Smartico. You put it on any page with one embed snippet, and you can change it at any time without a new release of your site.

See examples of widgets, landing pages, promotions and custom games made in Vibe Studio on https://smartico.dev.

How to create, publish and embed a widget: Widgets.

Other ways

  • The standard Gamification widget. Open it with _smartico.dp('dp:gf'), or embed it as an inline element on your page (see the links below).

  • Your own UI on the Smartico API. Your developers can build the whole interface themselves with the Smartico JavaScript API. https://expo.smartico.ai/widgets/api_widgets is an example of a UI built this way, with MatchX, Spin the Wheel, Scratch card and other components.

For the details of these integrations, see these articles:

Inbox widget

The inbox widget (or notifications widget) is an interface where the user can see the history of all notifications sent from Smartico CRM.

Example of Inbox widget with notifications

To open the inbox widget, use the following javascript code

You can also navigate to other sections using deep links. For a complete list of available deep links, see Deep-links.

You can also get a count of unread messages in order to show it in your own interface. The count is available as a callback and will be updated whenever the user gets a new message or marks some messages are read.

The Inbox widget is an additional feature that needs to be enabled on your setup.

There are also limits regarding the total inbox messages that can be sent monthly on one setup.

Please get in touch with your Customer Success Manager for details.

You can design a "bell" or "envelope" icon with a count of unread notifications, as shown in the example below.

Example of notification icon showing count of unread messages

Check if the user belongs to a specific segment

You can check if the user belongs to the segment.

You can use this functionality to change the front-end of your web-site based on the segmentation that is managed by smartico.

You can also use checkSegmentListMatch to verify multiple segments in one request; you can find more details here: https://github.com/smarticoai/public-api

Last updated

Was this helpful?