Skip to help content
RightMessage

Browser data conditions

Use values your website already stores to target visitors. You'll find the options for JavaScript variables, cookies, and localStorage, including what happens when a value is missing.

Available on the Grow, Scale, and Pro plans.

Updated

View as Markdown

You can target visitors using data your website already makes available in their browser, such as a plan level or a saved preference.

What it checks

Browser Data conditions read values that JavaScript can access on the visitor's website. They don't fetch private account data from your server or identify a contact by themselves.

When to use it

Use these conditions when your website already exposes the value you need as a JavaScript property, cookie, or localStorage entry.

For values saved by a flow's Set Data step, use score and variable conditions. Those are separate from your website's JavaScript properties and localStorage keys.

Options

Where to read the value

If you'd like to read…ChooseEnterHow long the value lasts
A property starting at windowJavaScript VariableA dot-separated path, such as currentUser.plan.levelIt follows the current page's JavaScript state. A full page load replaces that state.
A cookie visible through document.cookieCookieThe cookie's exact name, such as session_cookieIt follows the cookie's expiry, domain, and path rules.
A string stored on the current originLocal StorageThe exact key, such as preferences.darkModeIt lasts until the website or browser changes or removes it.

The name and comparison fields start blank. The operator starts with Equals.

Dots work differently in the name fields. currentUser.plan.level follows nested JavaScript properties. In Local Storage, preferences.darkMode is one literal key. It doesn't ask RightMessage to parse JSON.

How to compare it

All three options offer Equals, Does not equal, Contains, Does not contain, Starts with, Ends with, Wildcard match, Is set, and Is not set.

The comparison value is text. Is set and Is not set hide the comparison field. These conditions use the shared, case-sensitive text comparison rules, including comma-separated alternatives and numeric-looking values.

For a JavaScript array, Contains and Does not contain check whether the supplied value is an element in the array. They don't search for text inside each element. Other operators use the ordinary comparison behavior.

Examples

WorkForge (opens in a new tab) could use JavaScript Variable to check whether currentUser.plan.level Equals gold.

JavaScript variable condition matching currentUser.plan.level equals goldOriginal
JavaScript variable condition matching currentUser.plan.level equals gold

WorkForge would need to expose that value on its page first. RightMessage doesn't create the currentUser object.

Things to know

Missing and empty values

A missing JavaScript property, cookie, or localStorage key reaches the comparison as an empty value. An empty string also counts as unset.

  • Is not set matches an empty or missing value.
  • Is set matches a present, nonempty value. JavaScript false and 0 count as set.
  • Does not equal a nonempty value can match missing data.
  • Does not contain a nonempty value can also match missing data.

If you want to match a known plan other than gold, add a separate Is set condition. Without it, the negative rule can also include visitors whose plan you don't know.

Access and timing

JavaScript variables must be globally accessible. A module-local variable or a value held only inside a framework component isn't a window property. The path accepts dot-separated properties, not JavaScript expressions or function calls.

Cookies marked HttpOnly aren't visible to this condition. RightMessage reads cookie values as browser text, without URL decoding or JSON parsing. It reads the portion immediately after the first =, so a cookie value containing more = characters isn't read in full.

Local storage belongs to an origin. A value on app.example.com isn't automatically available on www.example.com.

These conditions don't necessarily pick up every later change immediately. If a value is absent when the rule runs, RightMessage evaluates it as absent.

Still need a hand?

Tell us what you’re trying to do and where you’re getting stuck.

support@rightmessage.com