# "Client action" event

Smartico has a special type of event called "Client action".

Such actions can be triggered from the front-end or through the REST API and can start real-time campaigns (Journeys), Automation rules, and progress/complete Missions or Badges.

{% hint style="info" %}
In order to see the "Client action" value in the Smartico BackOffice, you need to trigger it at least once; the triggered value will appear within 30 minutes in Smartico BackOffice automatically.

You can also register "Client action" manually in the Smartico BackOffice \ Tools \ Properties. Search for "Client action" property and use the "+" sign to add an action.
{% endhint %}

<div data-with-frame="true"><figure><img src="/files/JC9IBjVRHvZZgUmQrC5k" alt=""><figcaption></figcaption></figure></div>

## How to trigger client action from the front-end

You can report a specific action done by the end-user, for example, when the user is clicking on the submit button on the cashier page, you can report the action 'CashierSubmitClicked'.

```javascript

_smartico.action('CashierSubmitClicked');

```

As soon as the action is defined and triggered at least once, you can build a real-time journey to react to such an action.

<div data-with-frame="true"><figure><img src="/files/oofAmpl8ygbZV9SRqJAt" alt=""><figcaption></figcaption></figure></div>

You can also pass additional parameters in the event, like

```
_smartico.action('PIGGY-BANK-CLICK', { prize: 'ABC' }); 
```

In the backoffice, in the Query Builder, you can validate the value of the event payload (read [Query Builder](/welcome/products/crm-automation/segmentation/query-builder.md#event-evaluation-in-query-builder) article for more details about event evaluation)

<div data-with-frame="true"><figure><img src="/files/9Gd4IaryMWJG8JzkcSyc" alt=""><figcaption></figcaption></figure></div>

## Triggering a custom action through the URL (or any other deep link) <a href="#triggering-custom-action-through-the-url-or-any-other-deep-link" id="triggering-custom-action-through-the-url-or-any-other-deep-link"></a>

In some cases, you may want to start a campaign when the user reaches a specific page.

One option is to pass a special parameter in the URL of any of your pages.

For example, you can build a URL like:

```url
https://mycasino.com/deposit.html#_smartico_dp=dp%3Aaction%26action%3DDEPOSIT_OPENED
```

When a user comes on this page, you can catch him with the campaign waiting for the "Core: client action" and action DEPOSIT\_OPENED

<div data-with-frame="true"><figure><img src="/files/AyrkJKb9T7YZ7yNGtwzM" alt=""><figcaption></figcaption></figure></div>

Note: the passed parameter in our example is "dp:action\&action=TEST5" which is "URL Encoded". You can also pass any other deep links that will be triggered automatically after the user is logged in

## Trigger client action through the REST API

You can send client action using a server-to-server approach using Smartico REST API.

You can find details of the REST API in Smartico BackOffice \ Tools \ REST API (requires special permissions, as it contains secret keys that should be kept private).

<div data-with-frame="true"><figure><img src="/files/Pf6WjU9531NIJkn1iLcF" alt=""><figcaption><p>Example of payload in the REST API request</p></figcaption></figure></div>

The payload of the request should contain one required field called "**client\_action**" and may contain any other information.\
The event payload may include links to reset the password, email verification, or whatever you decide.

For example, your payload may look like

```jsonp
{
    "eid": "98866720-1ae7-452c-bc08-1b703954d2ea",
    "event_date": 1737986306201,
    "ext_brand_id": "spacex",
    "user_ext_id": "test98635568",
    "event_type": "client_action",
    "payload": {
        "client_action": "reset_password",
        "url": "https://mysitecom/reset?code=WREWSREGS"
    }
}
```

\
To handle this event, you need to prepare a real-time campaign triggered by the "Client action" event with Client action = "reset\_password" (or any other name you choose).

Within the campaign, you will send an email at the start. And inside the mail resource, you will write something like this

```html
Here is your link to reset password - <a href="{{event.url}}">click here</a>
```

Another case, you want to inform the client that he got a cashback.

```jsonp
{
    "eid": "98866720-1ae7-452c-bc08-1b703954d2ea",
    "event_date": 1737986306201,
    "ext_brand_id": "spacex",
    "user_ext_id": "test98635568",
    "event_type": "client_action",
    "payload": {
        "client_action": "cashback_ready",
        "cashback_amount": 44.22,
        "cashback_currency": "USD",
        "url": "https://mysitecom/activate_cashback?code=WREWSREGS"
    }
}
```

An example of email:

```html
You got {{event.cashback_amount}} {{event.cashback_currency}} in cashback, 
<a href="{{event.url}}">click here to activate</a>
```

You can validate any parameters of the event payload in the Query Builder. See more details in the [Query Builder](/welcome/products/crm-automation/segmentation/query-builder.md#event-evaluation-in-query-builder)


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.smartico.ai/welcome/products/general-concepts/client-action-event.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
