All questions

What duration units does CQL accept, only minutes?

Asked by Owen Fitzgerald on

OFOwen Fitzgerald

Saw this in the docs and it works fine:

session's duration > 5 minutes

I wanted a stricter threshold for a course-completion nudge so I tried a couple variations with seconds before checking anything. Some parsed, some I wasn't sure about. So before I keep guessing:

  • what duration units actually exist?
  • do durations only work with session's duration or can I use them elsewhere?

also does casing matter, I wrote Minutes at one point and it still seemed fine

Was this helpful?

1 answer

Ddelia

Durations are first-class literals in CQL, not something special-cased for sessions. 5 minutes is a value like any number or string, so it works anywhere a duration comparison makes sense and composes with other clauses:

session's duration > 5 minutes and session's stats' orders is 0

On casing: CQL keywords are case-insensitive (string literals are not), which is why Minutes parsed. Evaluation targets under 20ms, so there is no performance reason to avoid duration checks either, they are cheap to run on every interaction.

Since you are working with sessions, the full set of session attributes is worth knowing: start, end, duration, landingPage, referrer, and stats with pageviews, tabviews, and orders. For a course platform, combining duration with session's stats' pageviews often separates "left a tab open" from "actually engaged" better than duration alone.

Was this helpful?
Still have questions?