Scoring leads on a Strapi B2B site and targeting content by score
Our backend computes a lead score per visitor (0-100, based on pages viewed and firmographics). I write it to the profile like this:
croct.user.edit() .set('custom.leadScore', score) .save();Then I built an audience to show a demo CTA in a Strapi-fed section:
user's custom.leadScore is greater than 70The condition never matches, even for profiles where I can see the score was saved. What am I missing? Score is definitly there.
2 answers
Classic one. Custom attributes are written with the custom. prefix but queried without it in CQL. Your write is correct; the condition should be:
user's leadScore is greater than 70With 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).
Dropped the prefix in the condition, matches instantly. Write with prefix, read without. Noted.
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:
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.