# Scoring leads on a Strapi B2B site and targeting content by score

Asked by Jonas L on 2025-06-11. Tags: strapi, lead-generation, custom-attributes.

Our backend computes a lead score per visitor (0-100, based on pages viewed and
firmographics). I write it to the profile like this:

```js
croct.user.edit()
    .set('custom.leadScore', score)
    .save();
```

Then I built an audience to show a demo CTA in a Strapi-fed section:

```cql
user's custom.leadScore is greater than 70
```

The condition never matches, even for profiles where I can see the score was
saved. What am I missing? Score is definitly there.

## 2 answers

### Accepted answer from Emil Johansson (2025-06-11)

Classic one. Custom attributes are written with the `custom.` prefix but
queried without it in CQL. Your write is correct; the condition should be:

```cql
user's leadScore is greater than 70
```

With `custom.leadScore` in the query, CQL looks for an attribute that does not
exist, and undefined variables evaluate to false by design. That is why it
never matches instead of erroring: the design keeps conditions safe for
profiles that lack the attribute, which is exactly what you want once the
prefix is fixed (visitors without a score simply fall outside the audience).

#### Reply from Jonas L (2025-06-11)

Dropped the prefix in the condition, matches instantly. Write with prefix,
read without. Noted.

### Answer from chloe (2025-06-12)

Since you are building lead scoring anyway: consider firing manual events at
the moments that move the score, not just writing the number. `leadGenerated`
exists as a manual event, and `goalCompleted` takes a `goalId` payload:

```js
croct.track('goalCompleted', {goalId: 'demo-requested'});
```

Events give you conversion goals for experiments later, so when you A/B test
that demo CTA you already have the goal being tracked. The score targets who
sees the CTA, the event measures whether it works.
