A merchandising rule is represented as a merchandising object.
| Attribute | Type | Required | Content |
|---|---|---|---|
id | str |
| The id of the merchandising campaign, will be given after creation |
name | str | Required | The name of the merchandising campaign |
description | str | Optional | Description of the merchandising campaign |
active | boolean | Required | Determines if the merchandising campaign is active or not |
start_at | str | Optional | datetime stamp in format 'yyyy-mm-dd' |
end_at | str | Optional | datetime stamp in format 'yyyy-mm-dd' |
rules | list of rule objects | Required | The specific changes that the campaign should have on the results |
triggers | list of trigger objects | Required | The criteria for where the campaign should apply |
triggers_match | str | Required | Determines if all triggers should be satisfied to trigger the merchandising campaign, can be either any or all` |
Rules
Rules decide how the merchandising campaign should behave, e.g. which products should be boosted.
*Each rule object has an action and what products should be affected by that action. An action could be pinning or filtering products. The action can also be custom which then requires the multiplier argument to be set.
| Attribute | Type | Required | Content |
|---|---|---|---|
action | str | Required | Can be either remove, bury, promote, boost, custom, filter, pin, custom, |
selection | list or str | Required | Either a list of product ids, a query to find products or a filter. |
multiplier | float or int | Optional | Multiplies the score of products if the action custom is set. |
Triggers
Triggers decide where the Merchandising campaign should be activated.
A trigger can have several different types, and depending on the type, requires different arguments. A trigger can be either of global, searches_all, categories_all, recommendations_all, email_campaign_all, email_trigger_all, search, category, products, content, api, email_campaign, email_trigger . All triggers with type global or all, require no additional arguments. Below we will go through each non-global trigger and describe what options is required for each of them.
searchtrigger.
| Attribute | Type | Required | Content |
|---|---|---|---|
type | str | Required | searches_all, search |
query | str | Required | The search query that the campaign should target |
match | str | Required | exact, like, contains |
categorytrigger
| Attribute | Type | Content |
|---|---|---|
type | str | category |
category | str or int | The id of the category to trigger upon |
productstrigger
| Attribute | Type | Content |
|---|---|---|
type | str | products |
selection | list or str | Either a list of product ids, a query to find products or a filter. |
contenttrigger
| Attribute | Type | Content |
|---|---|---|
type | str | content |
content | str | The id of the content for which the merchandising campaign should apply |
apitrigger
| Attribute | Type | Content |
|---|---|---|
type | str | api |
endpoint | str | The endpoint that should trigger the merchandising campaign, for example recommendations/popular |
email campaigntrigger
| Attribute | Type | Content |
|---|---|---|
type | str | email_campaign |
email_content | str | The id of the email campaign that should be affected by the merchandising campaign |
email triggertrigger
| Attribute | Type | Content |
|---|---|---|
type | str | email_trigger |
email_trigger_content | str | The id of the email trigger |
{
"id": 7247299805359,
"name":[7247288664239],
"description": [7245445267631],
"active": true,
"start_at": "2022-09-15",
"end_at" : "2022-10-16",
"triggers": [{
"type": "search",
"query": "Sport shoes",
"match": "like"
},{
"type": "category",
"category": 199
}],
"triggers_match": "all",
"rules": [{
"action": "promote",
"selection": [123,456]
}]
}