Skip to main content

Data Sources 101

Your guide to understanding and using Rebuy Data Sources

Written by Christian Sokolowski
Updated over a week ago

What are Data Sources?

Data Sources (aka the rules engine) are the heart of the Rebuy Engine. The rules engine leverages AI and conditional rules (ie. IF this THEN that) rules to make it possible to tailor merchandising widgets across the entire customer journey from homepage to cart, checkout, post-purchase, and beyond. They enable targeted product selection, exclusions, and tailored collections to meet specific business needs such as promoting best sellers or excluding certain product types.

Data Sources rules are made up of two sections, ‘IF’ and ‘THEN’, which is referred to as “RETURN” in Rebuy Data Sources. Each section can have multiple rules leveraging different objects to power personalization. For more information on the various objects in each section and how they can be used, read the Anatomy of Data Sources section of this document.


Breaking down AND vs OR conditional logic

Data source rules in Rebuy are made up of IF and THEN (Return) conditions. When your IF section contains multiple objects, Rebuy combines them using either AND or OR logic — and the difference has a significant impact on results.

  • AND — all conditions must be true simultaneously. For example, "rough day AND it's Friday" means both must be true to trigger the rule. If only one condition is met, the rule won't fire.

  • OR — any one condition being true is enough to trigger the rule. "Rough day OR it's Friday" means either condition alone will fire the rule.

Best practices for rule sequencing

Rebuy evaluates data source rules sequentially, from top to bottom. The order of your rules directly impacts which products get returned.

  • Position your most specific or highest-priority rules at the top of the list. Manually targeted or tightly scoped rules should always sit above broad or general rules.

  • Broad catch-all rules — such as "if anything" — should always be at the bottom. These only fire if no rule above them matches. If a catch-all is triggering unexpectedly, check whether the rules above it are scoped correctly.

  • Enable Exit if Matched on rules where you want evaluation to stop once a match is found. This prevents broader rules lower in the list from overriding your specific ones.


Anatomy of Data Sources

Data Source Filters

Data source filters in Rebuy control which products are excluded from your widget's output before any rules are evaluated.

  • Filter out of stock products: This will prevent the data source from returning products with 0 stock. Note: If you have enabled a product to continue selling when out of stock, checking this setting WILL NOT prevent that product from being returned.

  • Filter out of stock variants: This will prevent out of stock variants from displaying in the product's variant selector.

  • Filter input products: This will prevent the data source from returning input products. On cart widgets, products added to the cart are input products. On product page widgets, the featured product is the input product.

You can filter out specific products by clicking Add Exclusion Filter. Learn more about exclusion filters in this help document.


To exclude specific products from appearing in certain widgets:

  1. Open the data source for each widget where you want to exclude the product.

  2. Add the product to the exclusion filter using the data source settings.

  3. Save and publish your changes.

This ensures that products can be selectively excluded or included depending on the data source rules applied to the widget.

Data Source Rules

Within a Data Source there are four different parts that are combined to create the rule. Those four parts are:

  • Object: This will be Product, Cart, Customer, Input Product, etc.

  • Attribute: This will be Product Tag, Product Vendor, Product Handle, Cart Total, etc.

  • Operator: This will be Contains Any, Doesn’t Contain Any, Contains All, Equals, etc.

  • Value: This will be the words you input in the rule like “blue-shirt”. Ex: “If Product Tag contains “blue-shirt”.

The tables below are grouped by object, and outline the corresponding attribute, operator and values. The tables will look something like the following:

Attribute

Operator

Value

Below each table are keys—aka tips and tricks—for each object group. While we tried to cover as many use cases and as much additional helpful information as possible, this is not an exhaustive list.

With that in mind, let’s dive in!


IF conditions: setting up your data source rules

This section of the Data Source is where we set what conditions need to be met in order for the Return portion to be presented or shown. 🔑 For rules at the top of your list, you can enable the "Exit if Matched" option to stop evaluating further rules once a match is found. This is particularly useful when you have specific product replacements or exclusions that should take precedence over general rules.

Anything

This means that any customer, product, URL, etc. will trigger the Return portion of the rule. 🔑 Use this when you want the rule to render at all times.


Order Rules

Use order rules to target customers based on the tags applied to their previous orders.

Order Tags

Equals Anything, Contains Any, Does Not Contain Any, Contains All, Equals, Does Not Equal

Search Order Tags // select one or more order tags


Product Rules

Use product rules to target or exclude specific products, tags, titles, vendors, types, or handles in your data source IF conditions.

Products

Equals Anything, Contains Any, Does Not Contain Any, Contains All, Equals, Does Not Equal

Search Products // select one or more products from your product catalog

Product Tags

Equals Anything, Contains Any, Does Not Contain Any, Contains All, Equals, Does Not Equal

Search tags // select one or more product tags

Product Title

Contains, Does Not Contain, Equals, Does Not Equal

Type the word/phrase you want included or excluded

Product Vendor

Contains, Does Not Contain, Equals, Does Not Equal

Type the word/phrase you want included or excluded

Product Type

Contains, Does Not Contain, Equals, Does Not Equal

Type the word/phrase you want included or excluded

Product Handle

Contains, Does Not Contain, Equals, Does Not Equal

Type the word/phrase you want included or excluded

🔑 Remember, when using ‘Equals’ or ‘Does Not Equal’ you need to type the exact word/phrase you want used. With ‘Contains’ or ‘Does Not Contain’, you can type keywords or partial phrases. ‘Equals’ requires an exact match where ‘Contains’ only looks for the words or phrases regardless of if there are other words around it.

  • 'Equals' Rule: This rule strictly applies to carts containing only the exact products specified in your rule. It acts as an "IF Only" condition, ensuring exclusivity. For example, if your rule specifies Product A, the cart must contain only Product A to trigger the rule.

  • 'Contains Any' Rule: This provides more flexibility by checking if any of the specified products are present in the cart. This rule is useful for broader applications, particularly when dealing with carts containing multiple product types. It avoids the constraints of exclusivity imposed by the 'Equals' rule.

Input

Input Products

Contains, Does Not Contain

Select Subscription Products or One-Time Products


Collection Rules

Use collection rules to target or exclude products based on the Shopify collections they belong to.

Collection

Equals Anything, Contains Any, Does Not Contain Any, Contains All, Equals, Does Not Equal

From a drop-down list, select one of your existing collections

Collection

Does Not Equal


Customer rules: filter by tag, order count, or spend

Use customer rules to target or exclude customers based on their tags, total order count, or lifetime spend.

Customer

Customer Tags

Equals Anything, Contains Any, Does Not Contain Any, Contains All, Equals, Does Not Equal

Type the tags you want included/excluded; if using more than one, separate with a comma

Customer Order Count

Is Greater Than, Is Less Than, Is Equal To

Type the number you want used for the rule

Customer Total Spent

Is Greater Than, Is Less Than, Is Equal To

Type the total dollar amount you want used for the rule


Cart Rules

Use cart rules to trigger your data source based on what's currently in the customer's cart, including specific products, subtotal, item count, or line count.

Cart

Contains, Does Not Contain

Search and select the products you want used for the rule

AND

Product Quantity

Less Than, Greater Than, Equals

Type the quantity of the specific product you want required for the Return to be shown

Cart Subtotal

Is Greater Than, Is Less Than, Is Equal To

Type the subtotal dollar amount you want used for the rule

Cart Line Count

Is Greater Than, Is Less Than, Is Equal To

Type the number of lines in the cart you want used for the rule

Cart Item Count

Is Greater Than, Is Less Than, Is Equal To

Type the number of items in the cart you want used for the rule

AND

With Tag

Is Greater Than, Is Less Than, Is Equal To

Type the product tag you want the cart to look at for the rule

From Collection

Is Greater Than, Is Less Than, Is Equal To

Select collection from the drop-down menu

Important: Cart Subtotal cannot be combined with other rule types for specific outcomes. For example, you cannot combine Cart Subtotal with Product Vendor to create a vendor-specific spend promotion (e.g., "$10 off when you spend $50 on Tarte products"). Cart Subtotal must be used as a standalone condition.


Date Rules

Use date rules to control when your data source is active, based on a specific date and time.

Date

Is Before, Is After

Select a date and time using the calendar icon, or type a date and time following the format in the ghosted text

(Note: you can select only a date if you don’t want to select a time as well.)

Use two date rules—one with a ‘Before’ and one with an ‘After’ operator—to create a date range.


URL Rules

Use URL rules to target your data source to specific pages or traffic sources based on the current page URL or UTM parameters.

URL

Contains, Does Not Contain, Equals, Does Not Equal

When using ‘Equals’ or ‘Does Not Equal’ – Type the complete URL you want used for the rule

When using ‘Contains’ or ‘Does Not Contain’ – Type key words or phrases you want used for the rule

(Note: if using more than 1 URL or phrase, separate with a comma)

Leverage URL to tailor rules to specific audiences like customer email/SMS or paid ad traffic.


Geolocation Rules

Use geolocation rules to target customers based on their physical location, including country, region, city, or postal code. Note that geolocation accuracy depends on IP data quality and is best used as a general targeting guide rather than a precise filter.

Attribute

Operator

Value

Examples

Country Code

Contains, Does Not Contain, Equals, Does Not Equal

Type the country code you want used for the rule

US = United States

CA = Canada

Country Name

Contains, Does Not Contain, Equals, Does Not Equal

Type the country name you want used for the rule

United States

Canada

Province Code

Contains, Does Not Contain, Equals, Does Not Equal

Type the province code you want used for the rule

Alberta, CA = AB

California, US = CA

Province Name

Contains, Does Not Contain, Equals, Does Not Equal

Type the province name you want used for the rule

California

Alberta

Continent Code

Contains, Does Not Contain, Equals, Does Not Equal

Type the continent code you want used for the rule

NA = North America

AS = Asia

AF = Africa

Continent Name

Contains, Does Not Contain, Equals, Does Not Equal

Type the continent name you want used for the rule

North America

Asia

Africa

City Name

Contains, Does Not Contain, Equals, Does Not Equal

Type the city name you want used for the rule

New York

Paris

Tokyo

Postal Code

Greater Than, Less Than, Equal To

Type the postal code you want used for the rule

10001 = New York

SW1A 1AA = London

10115 = Berlin

Latitude

Greater Than, Less Than, Equal To

Type the latitude coordinate you want used for the rule

40.7128 = New York

51.5074 = London

48.8566 = Paris

Longitude

Greater Than, Less Than, Equal To

Type the longitude coordinate you want used for the rule

-74.0060 = New York

2.3522 = Paris

139.6917 = Tokyo

Please note that the accuracy of our geo-location provider is subject to certain limitations and can vary depending on various factors such as the quality of the IP address data, network infrastructure, and other technical factors. We do not guarantee the accuracy of these geo-based rules and recommend using them as a general guide rather than relying on them for precise geolocation purposes.


Klaviyo Segments

Use Klaviyo segment rules to target customers based on the segments defined in your Klaviyo account. Rebuy matches customer emails from Klaviyo segment profiles to Rebuy customer records, keep your segments up to date in Klaviyo to ensure rules reflect current membership.

Attribute

Operator

Value

Examples

Klaviyo Segments

This will reflect the Klaviyo segments created in each merchant's instance, meaning the listed segment options will vary for each user

Contains User, Does Not Contain User

IF Klaviyo Segment Contains User "20k Customers"

RETURN "Top Sellers" Endpoint

Rebuy will pull Customer Segments from Klaviyo and then match emails from the Klaviyo profiles (associated to the segment) to Rebuy customer emails.

Merchants should continue to update and manage segments in Klaviyo to see updates in Rebuy Data Sources.

Read these help articles for more information on the available Klaviyo segments:


RETURN: what your data source returns

This section of the Data Source is where we set what will be shown if the conditions of the If portion are met.

Product

Use product rules to target or exclude specific products, tags, titles, vendors, types, or handles in your data source IF conditions.

No Products

Select this if you’d like the widget to Return no products.

Input Products

Select this to return the products that are being used on the If side of the rule.

Specific Products

Search for specific products and select the products you’d like returned for the rule

Products with Tags

Contains

Contains ALL Matched Input Tags

Contains ANY Matched Input Tags

Enter tags, separated with commas

Endpoint

Select the input you’d like used for this rule from the drop-down list

Default Endpoints:

  • Recommended (AI)

  • Top Sellers

  • Trending Products

  • Buy It Again

  • Recently Viewed

  • Similar Products (AI)

Collection

Select the collection you want used for this rule

Select “Sort By” option:


Product Filters

Product Price

Less Than, Less Than or Equal To, Equal To, Greater Than, Greater Than or Equal To

Type the dollar amount you want used for this rule. This rule must be used accompanied by a and "and" condition to return products.

Here are two different use cases for Product Price to get your wheels turning:

  1. Create a price range for products returned, for example, Product Price is greater than 75 AND Product Price is less than or equal to $200. This means the Data Source will select products that fall in the $75.01 and $200 price range.

  2. Product Price + Cart Subtotal + Cart Widget | IF Cart Subtotal is less than or equal to $50 RETURN Product Price less than or equal to $30.

When setting up a rule that involves the selection of "Product Price" as a return condition, it is essential to ensure that you include an "and" condition to return products. The available product return options include:

  • Input Products

  • Specific Products

  • Products with Tags

  • Products with Matching Metafields

  • Endpoints

  • Collection


Product Settings

Use product settings to control quantity and discount behavior for products returned by this rule.

Product Discount

Percentage, Fixed

Enter the percentage discount or dollar amount you want used for the rule

Product Quantity

Type the number of items you want added to the cart from the widget. (Ex: if you set the value to 3, then when the item is added to the cart from the widget it will add 3 x items)

Product Limit

Type the number of products you’d like the rule block to be limited to (Ex: if you set the value to 3, then the rule will only return 3 products.)

Important: The Product Discount setting in data sources is visual-only. It will not adjust the product price in the cart or at checkout. To apply an actual discount, create a Shopify Discount or use the Widget's Discount feature to enable a Shopify Functions discount. Learn more about discounting in Rebuy.


Widget Language

Use widget language settings to override the default text displayed on your widget, including titles, button labels, and cart state messaging, on a per-rule basis.

There are currently some Language options in the Data Source UI that are N/A for current Checkout Extension and Post Purchase widgets

Super Title

Type custom language for the widget’s Super Title here

Title

Type custom language for the widget’s Title here

Description

Type custom language for the widget’s Description here

Variant Option

Typing language in this field and the Variant Options field will override the settings in the widget editor.

Variant Options

Typing language in this field and the Variant Option field will override the settings in the widget editor.

Add to Cart

Type custom language for the widget’s ‘Add to Cart’ language here

Adding to Cart

Type custom language for the widget’s ‘Adding to Cart’ language here

Added to Cart

Type custom language for the widget’s ‘Added to Cart’ language here

Remove from Cart

Type custom language for the widget’s ‘Remove from Cart’ language here

Removing from Cart

Type custom language for the widget’s ‘Removing from Cart’ language here

Removed from Cart

Type custom language for the widget’s ‘Removed from Cart’ language here

Sold Out

Type custom language for the widget’s “Sold Out” language

Decline

Type custom language for the widget’s “Decline” button for an offer being presented

Thank You Title

Type custom language for the Thank You Page title

Thank You Description

Type custom language for the Thank You Page description

Thank You Button

Type custom language for the Thank You Page button

Use these Return options to create custom language on the widget in a variety of places. You can also use metadata variables to personalize widget language dynamically, pulling in real values like the customer's first name or the featured product title at the time the widget renders. For example, {{ metadata.shopify_customer.first_name }} would display as "Molly" for a customer named Molly, producing a title like "Faves Picked For You, Molly!"

The available metadata variables are:

  • Product Title — {{ metadata.input_products[0].title }}

  • Customer First Name — {{ metadata.shopify_customer.first_name }}

  • Vendor — {{ metadata.input_products[0].vendor }}


Widget Settings

Use widget settings to apply a visual discount label to products returned by this rule.

Widget Discount

Percentage, Fixed

Enter the percentage discount or dollar amount you want used for the rule

Important: The Widget Discount setting in data sources is visual-only. It will not adjust product prices in the cart or at checkout. To apply an actual discount, use the Widget's Discount feature to enable a Shopify Functions discount. Learn more about discounting in Rebuy.


Custom Data

Use custom data to pass additional key-value pairs to your widget for advanced personalization or developer-driven customization.

Data (String)

Key - We explain these in detail below.

Value - We explain these in detail below.

Data (Number)

Key

Value

Data (JSON)

Key

Value


FAQs

Can I duplicate a data source?

Yes, you can duplicate a data source. On the Data Sources page, find the data source you want to duplicate, click the three dots next to it, and select Duplicate Ruleset.

Can I export data sources to another Shopify store?

No, data sources cannot be exported to another Shopify store. Data sources are tied to specific product IDs within your current store, which makes them incompatible with other store environments.

What happens if a widget's data source rules aren't met?

If a data source's rules aren't met, the widget will not display any content to the customer. This happens automatically — no additional configuration is needed. Note that the widget remains installed on the page; it simply won't show any products until the conditions are satisfied.

How many rules can a data source have?

Rebuy recommends keeping data source rules to 30 or fewer per data source. You can add up to 50 rules, but exceeding this limit can cause slow widget load times and may result in failed saves. If you're hitting the limit, see the FAQ below on scaling beyond 50 rules.

What should I do when I need more than 50 rules?

If you need more than 50 rules, there are three approaches:

  • Collection and Tag Rules — Instead of targeting individual products, return products based on collections or tags. Broader coverage with far fewer rules.

  • Custom Endpoint — Create several data sources (each with around 25 rules), then link them into a single parent data source using Return > Endpoint > Custom Endpoint.

  • Multiple widgets — Duplicate your widget and assign each copy its own data source, keeping each one under the rule limit.

How can I avoid conflicting rules?

To avoid conflicting data source rules, check for overlapping criteria, for example, including and excluding the same product or tag simultaneously. Use logical rule sequencing and position your most specific rules at the top of the list. Broad or catch-all rules (such as "if anything") should always sit at the bottom, since Rebuy evaluates rules top to bottom and a catch-all will override everything below it.

How do I test if my data source is working correctly?

To test a data source, use the Preview tool to verify that the expected products or collections are being returned based on your rules. Manually simulate the conditions your rules target, for example, add the relevant products to a test cart or visit the relevant page and confirm the widget displays the correct output before going live.

What are best practices for naming data sources?

Use descriptive, specific names that reflect the data source's purpose and context — for example, "Product Page Cross-sell by Tag — Apparel" rather than "Data Source 12." Clear naming keeps your configurations organized and makes it easier to identify the right data source when building or editing widgets.

Which widgets automatically add products to the cart?

Only the Gift With Purchase (GWP) Widget and the Tiered Progress Bar (TPB) support automatically adding a product to the cart. All other Rebuy widget types display product recommendations for the customer to select, they do not add products to the cart on their own.

Did this answer your question?