Targeting returning shoppers on Hydrogen, which CQL condition is right?
I want to show a different homepage module to shoppers who have been to the store before versus first-timers. I have been poking at the CQL and I am not sure which condition actually captures "returning".
Here is my half-formed attempt, which I am pretty sure is wrong
user's visits is more than 1What is the correct form for a returning visitor?
2 answers
The direct one is:
user is returningThat is the built-in condition for a returning visitor, no counting needed. If you want to target on deeper engagement rather than just "has been here before", you can go to the session or user stats instead, for example:
session's stats' pageviews > 3or
user's stats' sessions is greater than 3Pick user is returning for the plain returning-vs-new split, and the stats forms when you want a heavier-engagement segment. These are audiences, so the condition is evaluated in real time on each interaction and attached to the experience that serves your module.
One behavior that makes this clean for your first-timer case: undefined variables evaluate to false by design. So a brand-new visitor, who has no prior session or returning flag set, simply does not match the returning audience and falls through to your default module. You do not need a separate "is first time" condition, the absence handles it.
matched exactly what I wanted, user is returning for the returning module and first-timers just get the default. thanks for the stats variants too