Skip to main content
Previewing Data Sources

Learn how to troubleshoot and test Data Source rules in the previewer

Strauss Van Wagenen avatar
Written by Strauss Van Wagenen
Updated over 4 months ago

By now you may know that Data sources are the main place where you can edit the business logic of a widget. For instance, if the Holidays are approaching, we may find it useful to return a Christmas collection to the customer. As such, we want to test what our widgets will show before they are seen by customers. In this doc you will learn how to test your data sources using the Data Source Manager.


Data Source Manager

This doc assumes that you have already gone through the process of building and setting up a data source but now want to test that it's working. Start by navigating to the data source you want to test and clicking on 'Preview Ruleset.

This will bring you to a page that looks like this.

Here you will see the six major sections,

  • Data Source: Input

  • API Endpoint

  • Data Source: Output

  • Data Source: Rules

  • Data Source: Filtered out of stock products

  • Data Source: Filtered input products


Data Source: Input

This section is where you will pretend to be a customer and buy a product. Below are all the inputs you can use in testing a data source, to get a detailed overview of it click on the drop down of each one.

Set the cart subtotal

If you have a rule that looks like this below

you can test this by adding a price that is over 49.99 to the cart subtotal input in the previewer our cart total input works in cents

Set Line Count

Lets say you have a rule that looks like something below and want to test it

Simply add a line count to the preview rule set like so to see an output after pressing Simulate

Set Item Count

This is implemented the same as Line Count but the difference is that Item Count goes off of the carts total quantity of items.

Set the number of items to return (Limit)

This setting is used to test what products may be returned if you had set in your widgets settings under layout how many items to show.

We can see here when I set the product limit to 10 like so even though the widget is set to only show 1 item we return 10 this is because the data source does not look at the widgets settings.

​

Set the Customer ID

This input field is useful if you are using rules that pertain to customers IE if customer tags contains wholesale the customers ID can be extracted from the URL while viewing the customers profile like so.

And then enter it into the customer ID field like below
​

You should see an output that shows the customer name and any matched rules or unmatched rules if there were any.

Run the simulation

This is the button that starts the simulation and gives an output below.

Input Products

This is where you will place input products that use all Product rules in the Data Source

Cart input products

Any rules in the data source that are using Cart rules I.E Cart contains any need to be inputed here to be simulated properly

Bust Cache

If you are not getting your expected results I.E you added a new product that should be getting returned and isn't try busting cache this will cause the data source to make fresh queries and not using any of the already cached data.

Set URL keywords

Lets say you had a rule that looked similar to this that contained a URL rule in this case it is the-complete-snowboard

adding the-complete-snowboard to the URL part in the input gives us the result we are looking for.


API Endpoint

This section has a sample API endpoint that you can use. This is not necessary to test most issues but useful if you are a developer who doesn't want to use our Data Source Manger.

Clicking on that endpoint will give open a new tab in your browser and return a JSON object of the output like below.


Data Source: Output

Once you have run a simulation, this section will show what has been output by the data source. This is an example of what the customer should see.


Data Source: Rules

After running a simulation, this section will display which data source rules have either been matched, unmatched, or not evaluated.


Data Source: Filtered out of stock products

Once you have run a simulation, this section will show what products have been filtered due to being out of stock. This will only show products if you have Filter Out Of Stock active on the data source settings.


Data Source: Filtered input products

Once you have run a simulation, this section will show what products have been filtered based off the input into the data source. This will only show products if you have Filter Input Products active on the data source settings.

Did this answer your question?