All questions

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

Asked by martak on

Mmartak

Write side:

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

Read side, in the audience editor:

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

Was this helpful?

1 answer

Croct Bot
AI
Accepted answer

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:

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.

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

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.

Was this helpful?
Still have questions?