> 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/crm-automation/segmentation/common-cases-segments.md).

# "Common Cases" Segments

## Overview

The "**Common Cases**" Segment is designed to simplify user targeting based on frequently used behavioral patterns. It offers a selection of predefined templates, allowing you to quickly configure conditions and control rebuild settings.

{% hint style="info" %}
**We are planning to add more cases based on client requests.**

If you cannot meet your segmentation needs, please raise a ticket in Smartico JIRA with an explanation of the required segmentation conditions, and we will review your specific case.
{% endhint %}

The "**Common Cases**" segment is available in the Segments section of the Back Office. To use it, simply select "**Common Cases**" when creating a new segment, then complete the required setup based on the selected template.

In the **Template** list, the templates are grouped: **Campaigns and Segments**, **Communication**, **Bonuses**, **Forms**, **Mini-games**, **Missions & Badges**, **Tournaments**, **Raffle** and **Other Gamification**. Most templates are shown only when your label has the Gamification product. The **SQL-based segment from external database** template is shown only after Smartico activates the **SQL Segments** feature for your label. Read more in [#sql-based-segments-from-your-own-database](#sql-based-segments-from-your-own-database "mention")

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-332c86bb0afffcc05f7870900c60a1a1652a9a21%2Fr2-064-crop-1-2ccab465-cfef2d.png?alt=media" alt=""><figcaption></figcaption></figure></div>

You can also use "Common cases" segments as a sub-condition of other segments by selecting a specific "Common Case" segment. This can be done using the property: `Core: CSV & Common case segments`

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-bc84870fb50fa9177b37c23301ab4774c6f350af%2Fr2-068-crop-2-32e1a3ec-6cf7bd.png?alt=media" alt=""><figcaption><p>BO: 'CSV &#x26; Common case segments' property in User state segments</p></figcaption></figure></div>

## How to set up

**Selecting a Template**

* Choose from a list of predefined "Common Case" templates.
* Each template includes specific conditions.
* After selecting a template, configure the related conditions to define your segment.
* Many templates have an "in the last X days" field. Turn on **Specify dates** next to it to select a date range instead. The longest period depends on the template (30 days for most of them).

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-facb295e5c55e5acae4c60e84f26a35b9e6ba452%2Fr2-070-shot-3-0590c410-f434ac.png?alt=media" alt=""><figcaption><p>Creating a Common Cases segment from a template: 1 — Template; 2 — the template's own fields; 3 — Specify dates; 4 — Rebuild schedule</p></figcaption></figure></div>

**Segment Rebuilding Logic**

* **Rebuild schedule** is on (**Yes**, daily) by default for a new segment. The only exception is **Lock User State Segment**, where it is off (**No**) by default.
* When **Rebuild schedule** is **No** - the system will automatically rebuild the segment once immediately after it is created - to populate the user list. After this initial rebuild, the segment will not update again unless manually triggered.
* When **Rebuild schedule** is **Yes** - No automatic rebuild after creation - the segment will rebuild only on the scheduled date or when manually triggered via the 'Rebuild Segment' button.

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-8f34df107ca4ae78e969b5e02dec8145e396ef0a%2FScreenshot_4.png?alt=media" alt=""><figcaption></figcaption></figure></div>

When setting the rebuild schedule, the system will automatically select a time with lower system load by default. You can change this to a different time if needed. However, if the selected time falls within a high-load period, a message will appear recommending an alternative time to help avoid calculation delays. You can still proceed with your chosen time - the system will display an estimated delay for your reference.

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-dab46ec9faad24e123479c82982ae649ef29d6db%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure></div>

**User Lists**

* **Real-Time Users List** Tab:
  * Displays users currently (in real-time) matching the segment conditions
  * Updates are live, but do not represent the saved segment users
* **Segment Users** Tab:
  * Shows the list of users from the last completed rebuild
  * This is the <mark style="color:green;">**active**</mark> list used for actions like campaign targeting

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

## **Supported common cases**

#### **Users with failed communication of resource X in campaign Y**

* Campaign - select the Campaign
* Fail Reasons - select the fail reason(s)
* Resource Type - select the communication channel. After that you can also select the **Resource**
* Number of failed communications - how many failed communications the user has, e.g. ≥ 1
* Period when failed to send communication - select the time period when the communication was not sent (at most 30 days)

#### **Users that have X remaining spins in the Mini-game Y.**

* Name of mini-game (only games based on the spin attempts) - select one or more mini-games
* Min. Amount of remaining spins - the segment includes users who have at least this number of spins left

#### **Users who registered in specific tournament**

* Tournament - select the tournament
* Select Instance - select the tournament instance:
  * **Current Run** - the instances that are now in status PUBLISHED, REGISTER, STARTED or FINALIZING
  * **Completed Runs** - all finished instances
  * **Last Completed Run** - the last finished instance
  * a specific instance, shown as **Run ID** with its end date
* Select users by points or by position - you can segment users by the score points they have (**Minimum score points** and **Maximum score points**) or by the position they have (**Position, from** and **Position, to**) in the selected tournament

#### **Users who have opted into a mission but haven’t completed it**

* Mission - select the mission
* Opted in, in the last X days - filter players who opted in during the selected period

{% hint style="danger" %}
Please note that:

* Progress in a recurring mission only counts for its current instance. Progress from previous instances does not carry over or get saved.
* All users who have made progress in at least one task but haven’t finished them all will be included in the segment.
* In this template and in "Users who have made progress in mission X, but haven’t completed it", the segment also includes users whose mission has expired (was missed), if the mission had a time limit.
  {% endhint %}

#### **Users who have made progress in mission X, but haven’t completed it**

* Mission - select the mission
* Had progress in the last X days - filter players who made progress during the selected period

#### **Users who have completed mission X, but haven’t claimed the prize**

* Mission - select one or more missions. Leave it empty to include any mission that requires a prize claim
* Completed mission, in the last X days - filter players who have completed the mission during the selected period, but haven't claimed their prize

#### **Users who have made progress in Badge X, but haven’t completed it**

* Badge - select the badge
* Had progress in the last X days - filter players who made progress during the selected period

#### **Users who have played mini-game X, but haven't claimed their rewards**

* Mini-game - select the mini-game
* Unclaimed prizes - select the prize. Only claimable prizes will be displayed.
* Got rewards in the last X days, but didn't claim them - filter players who had unclaimed rewards in the selected period

#### **Users who have opted in to a Jackpot X**

* Jackpot - select the Jackpot
* Had opted in, in the last X days - filter players who opted in during the selected period

#### **Users who finish in position X in the Leaderboard**

* Leaderboard - select the Leaderboard
* Position, from - select the player position from (e.g., from position 1)
* Position, to - select the player position to (e.g,. to position 10)
* The segment uses the latest saved results of the selected leaderboard

#### **Users who completed X Badges**

* Badges Completed (From) - specify the minimum number of badges completed by the player
* Badges Completed (To) - specify the maximum number of badges completed by the player (e.g., player completed between 1 and 10 badges)
* Completed badges in the last X days - filter players who completed a specific number of badges for the selected period

#### **Users with failed bonus Y given by X**

* Given by - define where the bonus was issued from (Campaign, Automation Rule, Mission, Mini-game, Store, etc.)
* Activity - select the specific campaign, mission, store item, mini-game, etc that issued the bonus
* Period when bonus failed - define the period when the bonus has failed

#### **Users who won in a Raffle draw**

* Raffle - select the ID/name of the raffle
* Draw - select the name of Draw
* Days count - set a time window

#### **Users have push token with status X for platform Y**

* Platforms: select the platform (Chrome, Safari, Native Android, Chrome mobile, etc.).
* Token status - select the status of the token (Active, Inactive, Invalid)
* Min. tokens count - select the minimum token count
* Max. tokens count - select the maximum token count

#### **Users have X tickets for Raffle Y**

* Raffle - select the ID/name of the raffle
* Tickets count from/to – define the ticket range to filter users based on how many tickets they’ve earned for the selected Raffle

#### **Users who are qualified for tournament X, but didn't opt in**

* Tournament - select the tournament
* Instance - select the tournament instance

#### **Users who have opted in to tournament X, but are not qualified**

* Tournament - select the tournament
* Instance - select the tournament instance

#### **Users who have ever opened the Gamification Widget**

* Opened Section/Modal (Ever) - select the section/modal/GF widget that was opened
* Opened section/modal in the last X days - filter players who have opened the section/modal/GF widget in the selected period

#### **Lock User State Segment**

* Select segment - define the segment you want to lock\ <mark style="color:purple;">Read more in the</mark> [#locking-option-for-user-state-segments](#locking-option-for-user-state-segments "mention")

#### **SQL-based segment from external database**

* External Database - select your database. Smartico adds it to this list when the feature is set up for your label
* SQL - the query that Smartico runs on your database to get the users of the segment

{% hint style="warning" %}
This template needs activation and special setup. Read more in [#sql-based-segments-from-your-own-database](#sql-based-segments-from-your-own-database "mention")
{% endhint %}

#### **Users who opted-in into a mission**

* Mission - Select a mission to segment players who have opted in to it (regardless of completion)
* Opted in, in the last X days - define the time period to filter users who opted in to the selected mission within that timeframe.

#### **Users who participated in Campaign X**

* Select Campaign - Select the campaign in which the users participated.
* User progress state - Select the user's campaign progress state (e.g., Still in Campaign, Finished).
* Started in the last X days - define the time period to filter users who have entered in the selected campaign within that timeframe.
* Finished in the last X days - define the time period to filter users who have completed the selected campaign within that timeframe.
* Converted in the Campaign - define if the users have converted in the Campaign or not

#### Users who bought a store item in the last X days

* Select Store item - select the store item or store items that the user bought. Leave it empty to include any store item
* Bought in the last X days - define the time period to filter users who bought the selected store items

#### Users who didn't open recent communications

* Communication channel - select the communication type that was sent, e.g. email, SMS, Viber
* Sent in the last X days - define the time period to filter users who didn't open specific type of communication
* Minimum number of not opened communications - define how many not opened communications the users have in the specified period

#### Users who have bonus X with status Y

* Bonus template - select the bonus template that was issued. Leave it empty to include any bonus template
* Bonus status - select the status of the bonus that was issued
* Issued in the last X days - define the time back period when the bonus was issued, for example 10 days ago

#### Users who received Resource X from Campaign Y

* Resource type - Select the channel the resource was sent through. For example, SMS, email, push, inbox, pop-up, etc.
* Campaign - Select the Campaign from where the resource was sent
* Resource - Select the resource from the selected campaign
* Delivery outcome - Optionally narrow the segment to specific delivery outcomes. A user is included if the resource reached any of the selected outcomes. Leave empty to include everyone who received the resource. The available outcomes depend on the selected channel.
* Received in the last X days - Define the time back period when the resource was received, for example 10 days ago.

#### Users who submitted X data in Forms

* Form template - select the Form template submitted by the users
* Form fields - select the field(s) within the chosen form template that you want to segment by

Once you select a field, a new section will automatically appear. The available setup options depend on the field type:

* Text: Input exact words or terms to match user responses (e.g., *John*, *Slot*).
* Number: Enter exact numbers or define a range using the "From" and "To" fields. Leave "From" blank to target values less than a specific number, or leave "To" blank for values greater than a specific number.
* Date: Select an exact date or date range using the date picker. Similar to numbers, you can set open-ended ranges to target dates before or after a specific date.
* Checkbox: Toggle between True (checked) or False (unchecked) to filter by selection.
* Selected Option: Select one or multiple answers.

## SQL-based segments from your own database

The **SQL-based segment from external database** template builds a segment from a SQL query that Smartico runs on your own database. Use it when the data you need to target users is in your systems and not in Smartico. For example: users who have partly used their bonuses in your bonus system.

{% hint style="info" %}
This feature is not on by default. It needs activation and special setup by Smartico. To request it, raise a ticket in Smartico JIRA.
{% endhint %}

### How to activate

1. Ask Smartico to activate the **SQL Segments** feature for your label.
2. Give Smartico read-only access to your database:
   * Supported databases: PostgreSQL, MySQL and Microsoft SQL Server.
   * Create a separate database user that can only read data, and only from the tables you need for segments.
3. Smartico sets up the connection to your database for your label. After that, the database is shown in the **External Database** list of the template.

{% hint style="danger" %}
Smartico runs the SQL query exactly as it is written in the segment. Give the database user read-only rights only.
{% endhint %}

### How to create the segment

1. Go to Segments > Create > Common cases segment.
2. In the **Template** list, in the **Campaigns and Segments** group, select **SQL-based segment from external database**.
3. In **External Database**, select your database.
4. In **SQL**, write the query that returns the users of the segment. Use the SQL syntax of your database.
5. Set the **Rebuild schedule** and save the segment.

### Query rules

The query must return these two columns. Use these exact names, in lower case. If your columns have other names, rename them with `AS`.

| Column         | What it must hold                                                                       |
| -------------- | --------------------------------------------------------------------------------------- |
| `user_ext_id`  | The ID of the user in your system - the same user ID that you send to Smartico          |
| `brand_ext_id` | The ID of the brand in your system - the same external brand ID that is set in Smartico |

Example - users who have partly used their bonuses:

```sql
SELECT DISTINCT
    b.player_id AS user_ext_id,
    'my_brand' AS brand_ext_id
FROM bonuses b
WHERE b.amount_consumed < b.amount_issued
```

If you have only one brand, you can return its external brand ID as a fixed value, as in the example above.

### How it works

* Smartico runs the query on every rebuild of the segment: on the schedule, or when you click **Rebuild Segment**.
* Smartico finds each returned user by `user_ext_id` and `brand_ext_id`. Rows that do not match a user in Smartico are skipped.
* If the query returns no rows, the segment has no users.
* If the query fails, or one of the two columns is missing, the rebuild fails. Fix the query and rebuild the segment again.
* Keep the query fast. It runs on your database, so a heavy query adds load to it.

## Locking Option for User State Segments

The Lock User State Segment feature allows you to “freeze” the user list of any state-based segment at a specific point in time.\
This ensures users remain in the segment even if their behavior changes later.

### Why This Is Needed - Example

Imagine you are running a promotion:

* Target users: Users who haven’t deposited for 30 days
* Promotion rule: They must deposit to get an attempt in the mini-game

You create a segment defined as:\
“Users that haven’t deposited for 30 days.”

#### The problem

As soon as a user makes a deposit:

* They immediately drop out of this segment
* Because the mini-game is restricted to that segment, the user can no longer access the promotion - even though their deposit was required to qualify

This creates a logical conflict:\
The user must deposit to participate, but depositing removes them from the segment.

#### The Solution - Locking the Segment

To solve this, Smartico introduces the Lock User State Segment mechanism.

Instead of directly using the state-based segment, you can now lock it by creating a Common Case segment that copies the user list from the original segment.

#### How it works

1. You select any state-based segment (e.g., “No deposit for 30 days”).
2. You create a Common Case segment that:

* Takes a snapshot of the user list from the original segment
* Does this either once or on a scheduled basis (daily, weekly, etc.)

3. The Common Case segment becomes a frozen version of the segment:

* Users stay in it even if their behavior changes later
* Perfect for promotions that require stable user lists

#### Result

Your promotion can safely:

* Target users who had not deposited for 30 days
* Require them to deposit to unlock the mini-game
* Keep them eligible even after they deposit

The Common Case segment ensures the user list is stable, predictable, and refreshed only when you choose, not instantly when user behavior changes.

### How to setup

It can be created in Segments > Create > Common cases segment

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-0f31507f21c47ece49572959f81c582e95b3cfdf%2Fr2-069-crop-8-b4cc4cc4-60949d.png?alt=media" alt=""><figcaption></figcaption></figure></div>

From the templates list, choose **Lock User State Segment**.

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-ce7b1054f3c79e9c9028a675438e77e29af8424f%2Fr2-071-shot-9-e826a36f-652610.png?alt=media" alt=""><figcaption><p>The Template list, grouped: 1 — a group; 2 — Lock User State Segment</p></figcaption></figure></div>

### Segment Eligibility Rules

When “Lock User State Segment” is selected, the system shows only segments that qualify for this feature:

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-410458c7a70673cf61963974423ed99822f3c8e3%2Fr2-065-crop-10-e10b9e29-3513f6.png?alt=media" alt=""><figcaption></figcaption></figure></div>

**Eligible segments:**

* User State Segments are built entirely on state-based conditions.

**Not Eligible segments:**

* Segments created from CSV imports.
* Segments based on behavioral data.

### Locking Behavior

Once a segment is locked, its user list becomes static. The membership reflects the exact users present at the moment of locking and will not update automatically as the user states change. The locked user list can be found at the "Segment Users" tab:

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-0c74434595c27ecfa7a8782c8922bcb31e6e651e%2Fr2-066-crop-11-5f6d6aae-24c529.png?alt=media" alt=""><figcaption></figcaption></figure></div>

The scheduling option remains active, giving operators full freedom to choose when the segment should be rebuilt and its user list adjusted. It can also be rebuilt manually from the top right corner:

<div data-with-frame="true"><figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-c3a6c84c0866fb2bbd953c0edb20ba573cbc8613%2Fr2-067-crop-12-f2456265-169733.png?alt=media" alt=""><figcaption></figcaption></figure></div>


---

# 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/crm-automation/segmentation/common-cases-segments.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.
