Skip to content

How-To: Merchandise on a Specific Category

Some use cases require you to be able to target a merchandising rule towards a specific Product Listing Page, without affecting the rest of your site. Nominally, this can be accomplished with the use of a distinct Display Location, but in the event that you either cannot or will not add a new Display Location, it is possible to specify the target of the rule to be only a specific category. This is done by targeting the product category ID filter in the API request itself.

DEPENDENCIES

NOTE that this method is contingent on using the Relewise search to construct your PLPs (i.e. by using a termless search with a category ID filter). If your PLPs are created via some other method, you will not be able to use Relewise's merchandising on your PLPs at all.

This guide is not concerned with what your Merchandising rule is supposed to do, and only concerns itself with how you target a specific category. This method is applicable to all types of merchandising rule.

To set this up, you will need one of the following set up ahead of time:

  • Your PLPs are created with the Relewise Search
  • Having user tracking set up is not required, but will make your work much easier

Request Filter vs. Display Location

This method of performing a Rule Scope based on a request filter only works when the Rule Scope and the filter are exactly the same. That also means that you cannot make one merchandising rule to apply the same logic to multiple categories using this method.

If you have multiple categories that should all be affected at the same time, we strongly urge you to implement a distinct Display Location instead.

Merchandising on a Specific Category ID

To apply a merchandising rule only to a specific category, we will be using the Rule Scope Request Filters. This scope specifies that the API request that the merchandising rule is affecting, must contain a specific filter. Be aware that this means that the filter must be exactly as specified, as the Request Filters setup in the merchandising rule will be evaluated 1:1 with the incoming API request.

The Request Filter rule scope is what makes this method work

In order to ensure that you are matching the incoming request's filter exactly, the easiest way is to capture it from the Search Overview page.

Retrieve your User ID

  1. In one browser window, open the My Relewise Search Overview page
  2. In a second browser window, open your website
  3. Now we want to find your user ID. Enter a search into your website's search bar, and immediately refresh the My Relewise Search Overview page. You should be able to find your search without too many issues - for ease of use, try entering something distinct, like a string of nonsense characters, e.g., "qweqweqwe"

Use the Search Overview page to find your user ID

You are looking for the information contained in the User field - copy this and keep it handy (Hint: You can click on the User ID to open up a User Entity modal, and copy the ID directly from there):

Copy the user ID from the User Modal

 

No User ID

If your solution does not allow you to grab a user ID for whatever reason, you can still follow the rest of the steps in this guide - you just have to manually figure out which of the requests in the Overview page is the one you have prompted. There is no shortcut to this without the user ID available - look at the product results on the overview page, and compare them with the products being shown on your product category page. If they are the same, you have found your request.

Retrieve your API Request

Now you need to isolate the API request being generated when you load your PLP page.

  1. On your website, navigate to the category page you want to affect, and keep the page open.
  2. In My Relewise, apply the User ID you retrieved above to the "Search" field, to only filter on your own requests

Filter the search requests by your user ID

 

  1. Refresh the category page on your website, and immediately refresh the Search Overview page. This should allow you to capture the PLP generation request (if it doesn't work after a few attempts, odds are you are not creating PLPs with Relewise - in which case this method will not work for you)
  2. With your request in hand, click the "Details" icon on the far right to open the raw JSON of the request

Click the Details icon to retrieve the raw JSON

Identify the Filter

You are now ready to retrieve the filter information for the PLP you want to merchandise on. Keep in mind that requests can differ in length and complexity, so this may be a bit complex. Do not lose hope, however; it is not as intimidating as it looks.

  1. With the Request Details open, scroll down (or perform a page search) to find the start of the "Filters" segment
  2. You will likely have more than one filter on your request, so look for where it says ProductCategoryIdFilter. Alternatively, you can perform a page search directly for it:

Locate the category ID filter details in the request

Create the Merchandising Rule

Now that you have the filter identified, keep it open, and navigate to your Merchandising page in My Relewise. Create whatever rule type you want, and turn your attention to the Rule Scope. Under "Request Filters", you will want to set up an "Include Filters" rule:

Create an Include Filters rule

You need to make sure that the rule matches the filter exactly. Follow these steps:

  1. Choose "Matches a Product Category"
  2. Copy the category ID from the filter into the rule
    • While it is technically possible to simply retrieve the category ID directly from the Product Categories Entities page, the fact that you will need to match the entire filter exactly means that you will save yourself a lot of work by just grabbing the request and using what's in it.
  3. Under "Category Scope", make sure that you match the value found in the filter, under EvaluationScope:

The Category scope must match the Evaluation Scope

Finalize the Merchandising Rule

With the correct category ID and category scope defined, your merchandising rule will now only apply to those requests that contain a filter exactly like the one you have been working off of. This means that no other product categories will be affected, and you can finalize your merchandising rule with whatever features you need.

Don't know us? Don't worry - you can find more information about us, by visiting our main page www.relewise.com