In digital marketing, an audience is the group of people who interact with your digital content. As a marketer or content creator, you want to ensure your content reaches the right people – the ones most likely to be interested in your product or service.
That is where audience segmentation comes into play.
When we talk about audience segmentation, we are essentially breaking down a larger audience into smaller, more specific groups based on their common characteristics, behaviors, or interests. This allows you to better understand your users and deliver content that speaks to their needs.
With Croct, things get even more exciting! Our real-time user segmentation engine allows you to adapt and create new audience segments as users interact with your content — no need to wait for historical data. This means you can respond to changes in user behavior and preferences on the fly, ensuring your content is always current, relevant, and engaging.
Before diving into the details, let's review some key concepts to help you understand how audience segmentation works.
Criteria are the conditions that determine whether a user is part of an audience. When creating an audience, you specify the criteria using our Contextual Query Language (CQL). This powerful query language lets you evaluate users based on real-time data, making it easy to determine which audience they belong to, even if they are new to your business.
Check out the Examples section for some of the most frequently used CQL queries.
The evaluation process is the heart of audience segmentation. It consists of running a CQL query against the user's current context and returning a result.
While only boolean results are relevant for segmentation purposes, CQL queries can return other values such as text, lists, and more.
For segmentation, the result should be a boolean – true or false. If the evaluation returns true, the user meets the criteria and is considered part of the audience.
But you might ask, what information does CQL use to evaluate users? That is where context and variables come in.
Context is the set of information available to the evaluation process. It gives you insight into the user's environment, such as device type, visited pages, and more.
This contextual information changes as the user moves from one context to another. For example, a user may be at home on a mobile device and at work on a desktop.
Our integrations capture contexts in real time, allowing you to make informed decisions based on the most current data. We then expose this information as variables that you can reference in CQL queries.
We provide hundreds of variables that you can use to segment users based on their behavior, demographics, and more.
Most variables are context-independent, such as user, location, campaign, etc. Others, like page and browser, are context-dependent, meaning they are only available in certain contexts. For example, the page variable is available on a web page but not in an app.
User identity refers to identifiers – such as an email address, username, or customer ID – that enable organizations to recognize users across contexts and devices for a more seamless experience.
We classify users as anonymous or identified based on whether this information is available.
Anonymous users are those that your company does not explicitly identify. In other words, they do not have an associated identifier such as an email address or username.
These users are either new to your website, unauthenticated, or do not allow your company to identify them. Even though they are unrecognizable across devices, you can still build a profile using anonymous information — as long as they have granted permission under local privacy laws.
Conversely, identified users are individuals explicitly identified by a unique, persistent user ID. This allows companies to recognize users across sessions and devices for a more personalized and consistent experience.
In the next sections, we will show you a series of audience examples using CQL, divided into different categories.
Before we begin, please note that each variable in these examples references the current user's context. For example, the variable page points to the page the user is currently on. If the user switches to a different page, the value of the page variable will immediately refer to that page.
You can also use and and or conjunctions to create more sophisticated audiences. For example, you can combine user is returning with campaign's source is "prepaid" to create an audience of returning users who have interacted with prepaid campaigns:
user is returning and campaign's source is "prepaid"
With this in mind, you can use the following examples as a starting point for defining your own audiences.
The page variable allows you to create audiences based on the page the user is currently visiting. It includes information such as the path, referrer, query parameters, etc.
For example, you can create an audience of users who are visiting a specific page, such as the pricing page, with the following expression:
page's path is "/pricing"
For multiple paths, you can use the in test:
page's path is in ["/home", "/about", "/contact"]
Similarly, if you want to target users coming from a specific referrer page, such as Google, you can use:
page's referrer is "https://www.google.com/"
When dealing with query parameters, there are two ways to access them in a CQL expression. The first method works when your parameter contains only alphanumeric characters and underscores, such as coupon, product_id, referral, and so on. For example, if you want to match pages that have ?newsletter=daily-news, you can use:
page's query's newsletter is "daily-news"
For non-alphanumeric parameters like coupon-code, you can use the bracket notation:
page.query['coupon-code'] is "10off"
For more information on navigation variables, see the Navigation section.
The session variable summarizes the current user's browsing experience on your website. It offers valuable information such as statistics, the duration of the visit, the landing page, and more.
The referrer, which identifies the page that brought the user to your site, remains constant throughout the visit, even as the user moves from one page to another. This is useful for creating audiences based on where the user came from.
For example, you can create an audience based on a specific referrer using:
session's referrer is "https://www.google.com/"
The landing page represents the initial page the user arrived at and is an excellent way to tailor content based on where users began their journey on your site. For example, to create an audience of users who landed on a specific landing page, such as "first purchase", you can use:
session's landingPage matches "first-purchase"
Session statistics provide an aggregate view of session activity. For example, you can identify users who spent more than 5 minutes on your site and did not place an order using:
session's duration > 5 minutes and session's stats' orders is 0
You can even look at more granular activity, such as users who viewed at least 3 pages during their session:
session's stats' pageviews > 3
For more information on session variables, see the Session section.
👤 User profile
The user variable gives you access to the user's profile, including interests, activities, statistics, and any custom attributes you have defined.
user's interest contains "marketing"
You can also check if a user has one of the specified interests by using the contains either test:
user's interests contains either ["marketing", "sales"]
To check whether a user has all the specified interests, you can use the contains all test:
user's interests contains all of ["marketing", "sales"]
Conversely, you can check if a user does not have any of the specified interests by using the contains none test:
user's interests contains none of ["marketing", "sales"]
Access to any other standard or custom attribute follows the same logic. For example, you can use the default attribute age to match young adults:
user's age is between 17 and 30
The same applies to custom attributes. Suppose you have a custom attribute called score. You can check whether the user's score is above a threshold using:
user's score is greater than 10
Or, if you prefer a shorter syntax, you can also write:
user's score > 10
For more information on user variables, see the User section.
The location variable provides geographic information about the user, such as the continent, country, region, state, city, and time zone.
The least granular level is the continent, which you can use in a condition like this:
location's continent is "na"
location's country is "us"
You can also use the region's code or name to create an audience of users from a specific state or region. Note that the terms state and region are interchangeable in the examples below, so you can use either stateCode or regionCode.
This is merely a convenience to accommodate the fact that some countries use regions instead of states to denote administrative divisions.
Example using the state's code:
location's stateCode is "ca"
Alternatively, you can use the state's name:
location's state is "California"
You can also create an audience of users from a specific city:
location's city is "San Francisco"
For more information on location variables, see the Location section.
The campaign variable provides information about the marketing campaign that brought the user to your website or app. It includes details such as the campaign name, source, medium, term, and content.
For example, to target users who came from a specific marketing campaign named "Winter Sale", you can use:
campaign's name is "Winter Sale"
To target users based on a specific source, such as Google or Facebook, you can use:
campaign's source is "google"
You can also segment users who engaged with a campaign using a specific medium, like email or organic search:
campaign's medium is "email"
To focus on users who interacted with a campaign through a specific keyword or phrase, use the term attribute:
campaign's term is "sweater"
Lastly, if you want to target users based on a specific ad within a campaign, use the content attribute:
campaign's content is "main-banner"
For more information on marketing variables, see the Marketing section.
The cart variable provides information about the user's shopping experience on your online store. It includes details such as the stage of the process, items in the cart, the total amount, and more.
For example, to create an audience of users who have started the checkout process, but have not yet completed it, you can use:
cart's stage is "checkout"
If you want to focus on users with specific items in the cart, you can use a quantifier:
some item in cart's items satisfies item's name matches "t-shirt"
Another typical use case is to display messages or special offers based on the shopping cart state. Suppose you want to offer users free shipping on orders over $100 by displaying a message like "Add $20 more to get free shipping". Then, you can use:
cart's subtotal is less than 100
You can even use the discount coupon as a condition:
cart's coupon is "new-year"
This can be useful if you need to give detailed instructions about the coupon rules, such as displaying a message like "This is a one-time coupon for new users only".
For more information on shopping variables, see the Shopping section.
📅 Date and time
Suppose you have a recurring weekly promotion on Mondays, say Monday Madness. If you want an audience to match only on Monday, you can specify the following condition:
today's weekday is "monday"
And to check for a specific date, you can use:
today as string is "2023-04-08"
For more information on date and time variables, see the Evaluation section.
For example, if you want to target users who are using a mobile device, you can use:
device's category is "mobile"
You can also target users using a specific browser, such as Chrome or Firefox:
browser's name is "Chrome"
Or even a specific device vendor:
device's vendor is "Apple"
For more information on technology variables, see the Technology section.
Now that you have covered the basics of audience segmentation, you can dive deeper into CQL and data collection to unlock more advanced segmentation capabilities.
Here are some suggested topics to explore next: