> For the complete documentation index, see [llms.txt](https://docs.luciq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.luciq.ai/kmp/setup-luciq-for-kmp/custom-settings/setting-custom-data.md).

# Setting Custom Data

Attach user data, key-value attributes, custom events, tags, and an app variant to Luciq reports from shared Kotlin code so you can filter them later.

### 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 %}


---

# 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://docs.luciq.ai/kmp/setup-luciq-for-kmp/custom-settings/setting-custom-data.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.
