# Setting Custom Data

### User data (free-form string)

Attach a custom string to reports (e.g. JSON or key-value text):

{% code title="Kotlin" %}

```kotlin
LuciqKmp.setUserData("{\"plan\":\"premium\",\"region\":\"EU\"}")
```

{% endcode %}

### User attributes

Set key-value attributes that appear in the dashboard and on reports:

{% code title="Kotlin" %}

```kotlin
LuciqKmp.setUserAttribute("plan", "premium")
LuciqKmp.setUserAttribute("role", "admin")
val value = LuciqKmp.getUserAttribute("plan")           // suspend
val all = LuciqKmp.getAllUserAttributes()             // suspend
LuciqKmp.removeUserAttribute("role")
LuciqKmp.clearAllUserAttributes()
```

{% endcode %}

### User events

Log custom events (e.g. for analytics or filtering):

{% code title="Kotlin" %}

```kotlin
LuciqKmp.logUserEvent("purchase_completed")
```

{% endcode %}

### Tags

Append tags to bug reports for filtering and segmentation:

{% code title="Kotlin" %}

```kotlin
LuciqKmp.appendTags(listOf("beta", "v2"))
val tags = LuciqKmp.getTags()  // suspend
LuciqKmp.resetTags()
```

{% endcode %}

### App variant

Set the app variant (e.g. "beta", "production") for filtering in the dashboard. You can also set it in `LuciqConfiguration` at init:

{% code title="Kotlin" %}

```kotlin
LuciqKmp.setAppVariant("staging")
```

{% endcode %}

Note: On some platforms this may be primarily set at init; check behavior per platform.

### File attachments

Add file attachments to bug reports (e.g. logs or exports). You can add by file path or from in-memory data, and clear the list when needed:

{% code title="Kotlin" %}

```kotlin
LuciqKmp.addFileAttachment(path = "/path/to/log.txt", name = "log.txt")
LuciqKmp.addFileAttachmentWithData(data = bytes, fileName = "export.json")
LuciqKmp.clearFileAttachments()
```

{% endcode %}

Attachments added this way are included in the next report the user submits.

### Feature flags

Add or remove feature flags (for A/B or segment filtering):

{% code title="Kotlin" %}

```kotlin
LuciqKmp.addFeatureFlag(FeatureFlag(name = "new_checkout", variant = "on"))
LuciqKmp.addFeatureFlags(listOf(FeatureFlag("flag_a", "control"), FeatureFlag("flag_b", "test")))
LuciqKmp.removeFeatureFlag("new_checkout")
LuciqKmp.removeFeatureFlags(listOf("flag_a", "flag_b"))
LuciqKmp.removeAllFeatureFlags()
```

{% endcode %}
