# Imported Segments

### Overview

Imported segments are used for two purposes:

* You have a custom list of players that you build outside of Smartico and you want to make a segment from them
* You want o update some properties in Smartico side with data that is not available in the normal integration flow between your platform and Smartico.

### How to Import a Segment

To create an imported segment navigate to the Segments section, click on the "Create" button, and select the "Import Segment" option:

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-823e7d9d9f267ca9ac216c89a9e2550af447a9c9%2FScreenshot_33.png?alt=media" alt=""><figcaption></figcaption></figure>

Once clicked It will open a window where you'll have to add a name for the segment and upload the already prepared CSV file. Please note that there is a special formatting required for the data in order for the import to be successful. You can also download a template of the CSV file.

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-0434264754fd7baa9f1a35d26581b0a375a05a3b%2FScreenshot_34.png?alt=media" alt=""><figcaption></figcaption></figure>

Depending on a Label setting in the CSV file, you must have one or two mandatory columns - the *user\_ext\_id* and *core\_sm\_brand\_id.* In most cases the only mandatory column is user\_ext\_id.

***user\_ext\_id** -* is the user's external ID (without the brand indication in the beginning):

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-84f8cac130ff0c37dd12cd304368db7a169f33d4%2Fimage.png?alt=media" alt=""><figcaption><p><br></p></figcaption></figure>

***core\_sm\_brand\_id -*****&#x20;is** the brand ID for the brand of which the given user belongs. You can find this number in the user profile, the number standing before the user's external ID. In the example case is 31.

Note that ***core\_sm\_brand\_id*** column is required in case you have multiple brand and non-unique user\_ext\_id across them. For example you have user with id 55 in brand A and user with same ID in brand B. In order for Smartico to understand which exactly user should be imported, you need to specify the ID of brand

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

Once prepared the CSV file should look like this:

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

After adding the file, a quick check will identify any errors in the uploaded user data. Once the check is completed, you can proceed with the import by clicking '"Continue".

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

Once you click "Continue", the file validation process will begin. During this phase, you can decide whether to proceed with the import or stop the process.

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

If you choose to proceed with importing the CSV file, the import process will begin, and the segment will be created. However, it will remain in the 'Importing' status until all users are successfully imported.

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-99f9a7c97ead8c2d55927a7e4769e2e9e687d6d7%2FScreenshot_38.png?alt=media" alt=""><figcaption></figcaption></figure>

You can check the Import status inside the segment as well.

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

After the import is complete, you can view the successfully imported users under the 'Imported Users' tab. Any users who do not match existing usernames in the system will also be displayed under the 'Imported Users' tab.

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

### Updating other properties of user while importing segment

You can add multiple columns in your CSV with names that correspond to name of properties in Smartico system. For example you have found that some deposits where not sent to Smartico and you want to update properties **acc\_last\_deposit\_date** and **acc\_last\_deposit\_amount**. You will need to prepare a file with additional columns exactly with these names and values for users that you want to update. For the format of values, please see table below.

### CSV Import – Guidelines & Rules

When creating a **CSV Segment**, please follow these important rules and behaviors to ensure a successful upload:

#### ✅ **File Requirements**

* The file must be in **plain text CSV** format (comma-separated).
* **Do not use quotation marks** in any fields.
* Each property in the file must match a supported **data type** (see below).

#### **📊 Supported Data Types**

| Data Type          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `string`           | Text values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `numeric`          | Numbers only                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `enum`             | Numeric enumeration values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `boolean`          | Use `true/false` or `1/0`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `date`             | <ol><li>Different date formats are supported such as:</li></ol><ul><li>YYYY-MM-DD → 2024-03-25</li><li>YYYY-MM-DD h<span data-gb-custom-inline data-tag="emoji" data-code="24c2">Ⓜ️</span>s → 2024-03-25 22:22:32</li><li>MM-DD-YYYY → 03-25-2024</li><li>MM-DD-YYYY h<span data-gb-custom-inline data-tag="emoji" data-code="24c2">Ⓜ️</span>s → 03-25-2024 22:22:53</li></ul><p><em><mark style="color:purple;">\*below you can find the full list with supported date formats</mark></em><br><br>2. Timestamp in <strong>milliseconds</strong> (e.g. <code>1704147742000</code>). Use an <a href="https://www.epochconverter.com/">Epoch converter</a> to convert dates</p> |
| `multicurrency`    | Numeric values representing multi-currency fields                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `referenced value` | Numeric values referencing predefined lists or values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

**Supported date formats:**

| Date format      | Example             |
| ---------------- | ------------------- |
| YYYY-MM-DD       | 2024-03-25          |
| YYYY-MM-DD h:m:s | 2024-03-25 22:22:32 |
| YYYY-MM-DD h:m   | 2024-03-25 22:22    |
| h:m:s YYYY-MM-DD | 22:22:32 2024-03-25 |
| h:m YYYY-MM-DD   | 22:22 2024-03-25    |
| MM-DD-YYYY       | 03-25-2024          |
| MM-DD-YYYY h:m:s | 03-25-2024 22:22:53 |
| MM-DD-YYYY h:m   | 03-25-2024 22:22    |
| h:m:s MM-DD-YYYY | 22:22:65 03-25-2024 |
| h:m MM-DD-YYYY   | 22:22 03-25-2024    |
| YYYY/MM/DD       | 2024/03/25          |
| YYYY/MM/DD h:m:s | 2024/03/25 22:22:32 |
| YYYY/MM/DD h:m   | 2024/03/25 22:22    |
| h:m:s YYYY/MM/DD | 22:22:32 2024/03/25 |
| h:m YYYY/MM/DD   | 22:22 2024/03/25    |
| MM/DD/YYYY       | 03/25/2024          |
| MM/DD/YYYY h:m:s | 03/25/2024 22:22:22 |
| MM/DD/YYYY h:m   | 03/25/2024 22:22    |
| h:m:s MM/DD/YYYY | 22:22:22 03/25/2024 |
| h:m MM/DD/YYYY   | 22:22 03/25/2024    |
| YYYY.MM.DD       | 2024.03.25          |
| YYYY.MM.DD h:m:s | 2024.03.25 22:22:22 |
| YYYY.MM.DD h:m   | 2024.03.25 22:22    |
| h:m:s YYYY.MM.DD | 22:22:22 2024.03.25 |
| h:m YYYY.MM.DD   | 22:22 2024.03.25    |
| MM.DD.YYYY       | 03.25.2024          |
| MM.DD.YYYY h:m:s | 03.25.2024 22:22:22 |
| MM.DD.YYYY h:m   | 03.25.2024 22:22    |
| h:m:s MM.DD.YYYY | 22:22:22 03.25.2024 |
| h:m MM.DD.YYYY   | 22:22 03.25.2024    |

#### ⚙️ Upload & Validation Process

1. **Initial Validation:**
   * The system checks only the **first 20 users** in the CSV file.
   * If there’s an incorrect value in these rows, an error will specify the problematic column.

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-0219f3480ed7ea3b97120dd24ec43fb9857326fc%2FScreenshot_136.png?alt=media" alt=""><figcaption></figcaption></figure>

2. **Full Import:**

* If invalid values are found **after** the first 20 users, those specific rows will be **skipped** and there is a message with the number of the skipped users.

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

#### 🚫 Unsupported Properties

* Some user properties **cannot be updated via CSV import**.
* These will appear **greyed out** in the UI and will be **skipped automatically** during the upload.

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-57072b60a165d4c9abdf94ddaf5176473a92c097%2FScreenshot_139.png?alt=media" alt=""><figcaption></figcaption></figure>

### Update points/gems/diamonds via CSV

You can update points, gems, and diamonds for specific users via CSV.\
Using the **‘Import Segment’** feature in Segments, you can upload a CSV file and choose to add, deduct, or set values for user balances.

The required columns in the CSV depend on what you want to update and the type of operation. Below are the supported columns:

* `ach_points_balance` – updates current points (used for store, tournaments, mini-games)
* `ach_points_ever` – updates level progress points (only for leveling)
* `ach_points_leaderboard` – updates leaderboard ranking points
* `ach_gems_balance` – updates current gems balance
* `ach_diamonds_balance` – updates current diamonds balance
* `operation_type` – required when updating any balance;
  * options: <mark style="color:purple;">**add, deduct, set**</mark>

{% hint style="warning" %}
Note: If you're updating any currency column, the `operation_type` column is mandatory.
{% endhint %}

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-cf928e09cfb1fe8cbcb6f2b82a6dc130e7a1556f%2FScreenshot_4.png?alt=media" alt=""><figcaption><p>BO: Update points/gems/diamonds via Import Segment</p></figcaption></figure>

You can only apply one type of operation (add, deduct, or set) across all balances within a single row in the CSV. For example, if you’re updating both the points and gems balances in the same row and choose the add operation, both balances will be increased - you cannot add points and deduct gems in the same row.

However, you can apply different operations per user. For instance, you can add points and gems for one user and deduct them for another within the same CSV file. Below is an example of a CSV file that deducts points, gems, and diamonds from specific users.

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-541505b37f9ec93bb2a297a73882f32d4a145a63%2FScreenshot_5.png?alt=media" alt=""><figcaption></figcaption></figure>

### Upload ‘User Markers’ via CSV

You can **set** User Markers using a CSV import in Segments. This update also allows you to modify properties that accept array values.

{% hint style="warning" %}
I**mportant:** Uploading tags via CSV will completely overwrite any existing tags for a user. It is not possible to append new tags or remove specific ones using this method. If you need granular control over tags, please use the REST API.
{% endhint %}

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-d8e64f220632f861f6380c80593f4fed9fe1335f%2FScreenshot_9.png?alt=media" alt=""><figcaption><p>BO: User markers in User profile page</p></figcaption></figure>

**Required CSV Column -** `core_tags`

**Accepted Formats:**

* <mark style="color:green;">**\[ ]**</mark> - Sets empty value
* <mark style="color:green;">**\["text"]**</mark> - Sets a single user marker containing text.
* <mark style="color:green;">**\["text", "text1"]**</mark> - Sets multiple text-based user markers.
* <mark style="color:green;">**\["text", 10]**</mark> - Sets multiple user markers containing both text and numeric values.
* <mark style="color:green;">**\[10]**</mark> - Sets a numeric user marker.
* <mark style="color:green;">**\[10, 20]**</mark> - Sets multiple numeric user markers.

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-84fae43fb88e39c4437e7146a2009178408123a5%2FScreenshot_7.png?alt=media" alt=""><figcaption><p>BO: Importing CSV segment with User markers</p></figcaption></figure>

**⚠️ Important**: Updating markers via CSV import\
\
When updating markers using a CSV file, you can use either Excel / Google Sheets or a plain text editor (e.g. Notepad). However, there is an important difference in how these tools format the file.

* **Excel / Google Sheets** automatically add the required quotation marks and escape characters, so the file usually passes validation without extra work.
* **Plain text editors (like Notepad)** do not add this formatting for you. This means you must manually format the values correctly, otherwise the import will fail validation.

Required format for marker values (example):

```
core_tags:
"[""SMS TEST"", ""TEST ACCOUNT"", ""AFF TEAM"", ""CRM_TEAM_BASIC""]"
```
