Case Study
98% Faster Insights? The Weather Company Transforms Analytics See How They Did It

Back to Basics: What is Boolean Logic?

What is Boolean Logic?

The term Boolean means there is a result that can only have one of two values, similar to true & false. Boolean Logic, on the other hand, is a form of algebra that is centered around three simple words known as Boolean Operators: “Or,” “And,” and “Not.” These Boolean Logic operators are the logical conjunctions between your keywords in a search to help broaden or narrow its scope.

At the heart of a Boolean Logic expression is the idea that all values are either true or false. In other words, Boolean means using operators to compare variables against the criteria you define to determine if the variables meet them. A Boolean operation, then, is the construction of a logical expression to help carry out that function.

Within Lotame’s end-to-end data collaboration platform, Spherical, the use of Boolean Logic allows for the creation of more complex audience definitions, allowing for audiences to be built to a very specific set of definitions. This article explores the uses of individual Boolean Logic operators and how they relate to building audiences.

An Example of “OR”

An Example of “AND”

An Example of “NOT <“

Or, And & Not Emaple image


An Example of Boolean Logic at Work In Building Audiences : OR

Our first example of a Boolean operator is “OR,” which broadens your search. This operator is used to express that as long as one of two or more conditions are met, the value of a specified query is true. In computer logic, the search results will return a “true” for every variable you’re searching that meets the criteria — meaning your results will include any of the searched terms.

For example, to build an audience that encompasses anyone who enjoys Mexican, Chinese, or French Cuisine, the following audience definition would apply:

Using the “OR” operator would ensure that anyone who has shown an affinity for at least one of these cuisines will be included in the audience created.

Let’s look at a second example. Suppose your company or advertiser is a retailer of products, food, treats and remedies for dogs, cats and birds. To build this specific audience, you can use the Boolean expression “cat owners OR dog owners OR bird owners.” 

This Boolean operation will yield those who have cats, those who have dogs and those who have birds. It would also include households with any combination of those three animals. Yet, the search would exclude owners of reptiles, horses and other animals, delivering only the applicable target households. Using this logic ensures your custom content only displays to the relevant pet owner audience.


An Example of Boolean Logic at Work In Building Audiences : AND

As a Boolean operator, “AND” serves to indicate that ALL specified conditions must be met in order for a query to return true. Since all variables in the search logic must be true for the results to display, you maintain more control over who sees the relevant content. This operator is valuable for eliminating audiences who aren’t likely to need or use a particular product or service because it narrows the search. 

Remember you can use “AND” with more than two search variables — each condition you add must be true for the database to supply a result.

In the event that a client were building an audience and wanted to target only users who had shown an affinity for Sports Cars and Fishing and History, the following audience definition would apply:

audience boolean

The use of the “AND” operator means that a user must meet ALL of the specified criteria to be included in the audience; users who merely like Fishing or like only Fishing and History (etc.) will be excluded from this audience definition.

We can revisit our pet retailer as an example of this logic at work. Suppose the company has a product applying explicitly to households that own both cats and dogs, such as a smart pet door that allows dogs outside but keeps indoor cats inside. 

Use the Boolean logic “cat owners AND dog owners” to build the appropriate audience to target with this product. Your results will exclude the households that don’t have both pets and those only owning birds.


An Example of Boolean Logic at Work In Building Audiences : NOT<

The “NOT” Boolean operator is used to exclude nodes from an audience definition. As it applies to the creation of an audience definition, “NOT” will exclude all users falling under the node which has been prepended by “NOT.” By nature, “NOT” narrows a search. It will exclude any content containing the words following “NOT” and preceding other operators. As a result, it transforms the “true” parts into “false” to limit the results.

 In other words, the database looks for a “true” value in the information you want to omit and doesn’t report those results.

For example, to create an audience of users over the age of 18 (NOT 13-17 years of age) with a demonstrated interest in movies, the following audience definition would be used:

audience boolean

In this instance, the “NOT” which prepends 13-17 means that no users within this age range will be included in this audience definition. It is also worth noting that the “AND” operator is used here as well. Translated into plain English, this definition would be read as “Users who are not between ages 13 and 17 and who have an interest in movies.”

We can again see this action with the pet product retailer as an example. Imagine the company sells an all-natural flea repellent remedy that’s unsafe for use around birds. We’d want to use “NOT” to exclude households with birds. Combining it with “OR” will help us do just that. We can construct the Boolean expression to say, “cat owners OR dog owners NOT bird owners” to get the desired audience. Doing so ensures the ad or content only appears for those who could safely use the product in their homes.

When to Use Parentheses

Generally, databases give weight to “AND” first. Parentheses help you adjust for more emphasis on a specific concept by prioritizing the information within them, followed by information outside the parentheses. When you’re using both “AND” and “OR” operators, it’s generally best to enclose the “OR” items with parentheses.

For example, suppose the pet retailer is trying to build more business in Canada. To find this audience, they can use the Boolean construction “(cat owners OR dog owners OR bird owners) AND Canada.” This search would yield anyone who owns cats, dogs or birds and lives in Canada. 

Users of Lotame’s data collaboration platform, Spherical can use Boolean Logic to build audiences for targeted ads, content customization, and many other business applications. By understanding who your audience is, and grouping them into audience segments, you can personalize your messaging to increase engagement with your products & services.


Boost Engagement With Lotame

We are a leading partner for audience analysis, giving you deeper insight into your customers and website visitors. Our technology gives you a centralized source for gathering and leveraging data to deliver more relevant content. 

Want to learn more? Let’s chat. We’d love to show you a demo of our platform and how it can help your marketing work harder for you, to increase engagement and conversion rates. Fill out the form below and get in touch with us!