> 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/technical-guides/front-end-integration/extended-integration/callbacks-and-pausing-messages.md).

# Callbacks and pausing messages

Use these calls of the Smartico script to pause popups, inbox messages, mini-games and forms on sensitive pages, to listen to script callbacks, and to ask the player for push permissions.

## **Suspending online creatives**

Popups, inbox messages, forms, and mini-games can be suspended in some cases. Usually, it's done on the screens where the user shouldn't be interrupted from the main process, e.g., on the Deposit page or while completing a KYC form.

```javascript
// Disabling popups
 _smartico.suspendPopups(true);
// Enabling popups
 _smartico.suspendPopups(false);
 // Disabling inbox messages
 _smartico.suspendInbox(true);
// Enabling inbox messages
 _smartico.suspendInbox(false);
// Disabling mini-games that are triggered by server
 _smartico.suspendMiniGames(true);
// Enabling mini-games that are triggered by server
 _smartico.suspendMiniGames(false);
// Disabling Forms
 _smartico.suspendForms(true);
// Enabling Forms
 _smartico.suspendForms(false);
```

After disabling suspension, the popups, inbox messages and mini-games that were missed will be shown to the end-user if the client session remains active (the user didn't refresh the page or didn't navigate between pages). Missed forms are shown one at a time: the next one after the user closes the previous one. The suspension ends when the user logs out. Call these methods after you set `window._smartico_user_id`: without a user ID they print an error and do nothing.

Right after the user is identified, the Smartico script also holds popups, inbox messages, Prize Drop and Jackpot win popups, deep links and JS code activities for a short time. They are shown only when the time set in the **Delay for online messages right after login, ms** setting in **Label settings** has passed since the identification (1000 ms by default; 0 means no delay). Use it when your site reloads the page right after login, so that messages are not shown and then lost on the reload.

## **Smartico callbacks**

```javascript
/*
Callback when the script is initialized.
*/
_smartico.on("init", (errCode) => { 
});
 

/*
Callback when the user is identified.
'props' parameter contains public information about the user, like level, number
etc
*/
_smartico.on("identify", (errCode, props) => {
});

 
/*
Callback when some of the user properties are changed.
'props' parameter contains public information about the user, like level, number
etc.
*/
_smartico.on("props_change", (props) => {
});
 
/*
Callback when the user is logged in.
*/
_smartico.on("login", () => {
});
 
 
/*
Callback when the user is logged out.
*/
_smartico.on("logout", () => {
});
 
/*
Callback when the gamification widget is about to be opened or about to be    
closed.
*/
_smartico.on("gf_starting", () => {
});
 
_smartico.on("gf_closing", () => {
});

/*

Callback when a user clicks a game tile inside the widget (missions, tournament, store, or jackpot).

Use this to intercept game clicks and launch your platform's native game lobby.

By default, Smartico also opens the game link in the same tab (the mobile link on mobile devices).
To open the game only with your own code, turn on 'Don't open related games by link' in Label settings.

*/

_smartico.on("ach_game_opening", (eventData) => {

    console.log("Game clicked:", eventData);

});

/*
You can use 'off' method to unsubscribe from the notifications, 
for example
*/

const f = (v) => console.log(v);

// subscribe
_smartico.on("logout", f);
// unsubscribe
_smartico.off("logout", f);

/*
Listen to user interaction with gamification widget,
See an explanation below
*/

_smartico.on("gf_ux", ({screen_name_id, screen_subname_id, entity_id, custom_section_id}) => {
    console.log({
        screen_name_id,
        screen_subname_id,
        entity_id,
        custom_section_id
    });
});

```

## Listening of interaction in the Gamification Widget

You can use code below to get JavaScript callbacks, whenever user is navigating to different screens and modals inside the gamification widget

```javascript
_smartico.on("gf_ux", ({

    screen_name_id,

    screen_subname_id,

    entity_id,

    custom_section_id }) => {
        console.log({
            screen_name_id,
            screen_subname_id,
            entity_id,
            custom_section_id
        });
});
```

For example you can get notified when user opens missions modal with specific id.

All the interactions are also recorded in [Smartico Data Warehouse](https://help.smartico.ai/welcome/technical-guides/smartico-data-warehouse.md), so you can get historical interactions for later analysis.

For the semantic of parameters and possible values, please refer to [this explanation](https://help.smartico.ai/pages/PVn4StbDnSBjvWx8XTTk#dwh_ext_xxx.g_ux) on Data Warehouse page.

## Requesting push permissions

You can directly call the Smartico script to trigger the browsers' native dialog for push permissions.

This can be done for the already identified user or an anonymous (visitor). For a visitor, the script runs in [Visitor mode](https://help.smartico.ai/welcome/technical-guides/front-end-integration/visitor-mode.md) (or in Acquisition mode, which also gives the visitor an ID).

The push permissions token will be registered automatically on the Smartico side when the user is identified.

```javascript
_smartico.dp("dp:ask_push_permissions")
```

It's also possible to build marketing (acquisition) campaigns., gamification, and communication for anonymous users (visitors), please get in touch with your Smartico Customer Success Manager to make the needed setup and provide training.

## Frequently Asked Questions (FAQ)

### Does suspending mini-games also suspend Prize Drop and Jackpot win celebrations?

Yes. Calling `_smartico.suspendMiniGames(true)` suspends standard mini-games as well as server-triggered Prize Drop and Jackpot win popups. While suspended, incoming win notifications are held in memory and will automatically display when mini-games are re-enabled, as long as the user session remains active.


---

# 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/technical-guides/front-end-integration/extended-integration/callbacks-and-pausing-messages.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.
