How do I say "on checkout but has not purchased yet" in one CQL condition?
I want a nudge that only shows to people who are currently on the checkout page and have not already completed a purchase in this session.
I can express each half on its own, but I am stuck on how to negate one clause while still requiring the other in the same expression. Do I need two separate audiences or can it live in one condition
3 answers
One condition. not negates a clause and combines with and and or like you would expect:
page is "checkout" and not user has made purchaseThe not binds to the single clause after it, so the and still requires the page check. No need for a second audience.
That is exactly the shape I was missing, thanks. Reads almost like the sentence I said out loud.
Works, but one thing to check before you trust it: the purchase signal has to actually be tracked for the negation to mean anything. Undefined variables evaluate to false, which is normally handy, but it cuts the other way here. If user has made purchase is never populated it is always false, so not of it is always true and everyone on checkout matches.
So make sure the event that feeds that condition is firing. If you are matching on a completed goal instead, the retargeting on a completed goal thread has the exact form.
You can lean on the technical style for the parts that suit it and keep the behavioral clause in words, CQL lets you mix them:
page.path is "/checkout" and not user has made purchaseThe keywords are identical either way, so the negation stays readable however you write the surrounding clauses. I keep the natural form for anything a marketer will touch.