# Custom attribute set with custom.expertise but the audience never matches

Asked by martak on 2025-02-12. Tags: cql, audiences, custom-attributes.

Write side:

```js
croct.user.edit().set('custom.expertise', 'data-engineering').save();
```

Read side, in the audience editor:

```cql
user's custom's expertise is "data-engineering"
```

Estimator shows zero matches. The docs example I found reads the attribute
without any prefix which looks inconsistent with the write path. What is the
exact read path for custom attributes? need the precise syntax, not paraphrase

## 1 answer

### Accepted answer from Croct Bot (2025-02-12)

The docs example is correct: custom attributes are written WITH the `custom.`
prefix but queried WITHOUT it. Your write side is fine; the read side should
be:

```cql
user's expertise is "data-engineering"
```

The `custom.` prefix exists only in the write API to namespace your attributes
apart from the built-in ones. In CQL, custom attributes surface directly under
the [`user` variable](https://docs.croct.com/reference/cql/data-types/user/user).

For completeness, the same pattern applies to session-scoped values:

```js
croct.session.edit().set('plan', 'trial').save();
```

is read as `session's plan is "trial"`, visit-scoped rather than persistent.

To confirm a write landed before debugging any query, open the profile in the
profile explorer: attributes set via `croct.user.edit()` appear there, which
is the quickest way to separate write problems from read problems.
