Pages

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 14.4

...

PropertyDescriptionTypeRoleExample
category_delimiter


Note

This property is only valid for product recommendations whose type is most_converted or most_viewed.

Delimiter string by which to split the product category value. If the string is empty, the product category value is not split.

If you define a delimiter, you must include type in product_attrs.

The default value is an empty string ("").

StringOptional


Code Block
languagejs
themeRDark
"category_delimiter": "/"


min_weight


Note

This property is only valid for recommendations whose type is bundle_converted, bundle_viewed, or bundle_viewed_converted.

Minimum data point weight for including the data point (item) in the recommendation results.

For bundle product recommendations, a data point is a single recommended product, and the data point weight is the total number of times the product was purchased or viewed together with other products.

The default value is 0, meaning all data points are returned.

NumberOptional


Code Block
languagejs
themeRDark
"min_weight": 10


product_attrs


Note

This property is only valid for product recommendations.

Names of the product attributes by which to filter the recommendation results when using request parameters.

Define the names of the product attributes that correspond to the request parameters defined in the params array. You must define a matching product attribute name for every parameter (except for the final segment parameter, if defined) and in the order in which the parameters are defined in params. The names must match actual product attributes in the product data stored for your site.

To find out the available product attributes, use the Product API.

Info

The attribute names are based on the product object properties of a Product API response.

To reference a propertyan attribute, whether a direct property of the product object, such as name type, or a child property of the attributes object, such as price, simply use the corresponding property 's name.To reference within an array or object name, for example, type or price.

If a child property of the attributes object , use dot or bracket notation (propertyName.nestedName or propertyName['nestedName']) or index notation (propertyName[i]) as appropriate, depending on the nesting structure leading up to the target element or propertyis itself an array or object, you cannot reference its elements or properties.

The product_attrs array tells the platform how to map the parameters in the Recommendations API request to product attributes in the product data stored for the site.

For example, if you've defined a request parameter for product category, define type as the product attribute name to which the parameter maps, since type is the product attribute for product category or type.

You must define at least one product attribute name (corresponding to the one minimum request parameter in params).

Array of stringsRequired

One request parameter defined. Map the parameter to product category:

Code Block
languagejs
themeRDark
"product_attrs": [
  "type"
]

Two request parameters defined. Map the first parameter to product category and the second parameter to product brand:

Code Block
languagejs
themeRDark
"product_attrs": [
  "type",
  "manufacturerbrand"
]

No request parameters defined. Map nothing.

Code Block
languagejs
themeRDark
"product_attrs": []


segments


Note

This property is only valid for recommendations whose type is most_converted or most_viewed.

IDs of the segments by which you want to allow the recommendation results to be filtered. You can use the IDs in Recommendations API requests (as the value of the segment parameter) to retrieve the recommendations only for a given segment.

If you define one or more segment IDs, the params property must include a single parameter for segment ID as its last item.

If you do not define the ID of a given segment, you cannot filter the results by that segment.

For example, if you define segment as the last item in the params property, and you define the segment IDs 123 and 456 in this property, you can use either "segment": "123" or "segment": "456" as a parameter in a Recommendations API request to filter the returned items by the corresponding segment. You could not use the parameter "segment": "789", for example, since you did not define the segment ID 789.

Info

The segment IDs are numbers, such as 123, without the sgmt_ string prefix that you see as part of segment IDs in the Control Panel.

The default value is [].

Array of numbersOptional

Allow filtering by two segments:

Code Block
languagejs
themeRDark
"segments": [
  123,
  456
]

Do not allow filtering by any segment:

Code Block
languagejs
themeRDark
"segments": []


...

PropertyDescriptionTypeRoleExample
attributeName of the product attribute used for filtering products.StringRequired


Code Block
languagejs
themeRDark
"attribute": "type"


operator

Relational operator used to compare the value of the product attribute defined in attribute to the target value defined in value. The comparison is case-insensitive.

The platform supports the following operators:

  • =
  • !=
  • <
  • >
  • <=
  • >=
  • contains
  • notContains
  • startsWith
  • startsWithAny
  • endsWith
  • in (value must be a JSON-stringified array)
  • notIn (value must be a JSON-stringified array)
  • arrayIncludes
  • arrayNotIncludes
  • anyElementContains
  • anyElementStartsWith
  • anyElementEndsWith
  • regex
  • notRegex

By default, the platform treats the product attribute and value as strings. If the product attribute is price or quantity, and if the operator is <, >, <=, or >=, the platform treats the product attribute and value as numbers, not as strings, for comparison purposes.

For the array and any operators, the attribute must be an array of strings.

For regular expressions (regexBy default, the platform treats the product attribute and the target value as strings.

For more information about the supported operators, see Filter rule operators.

StringRequired


Code Block
languagejs
themeRDark
"operator": "!="


value

Target value against which the value of the product attribute defined in attribute is compared.

The value can be either a regular string or, if the operator is in, notIn, or startsWithAny, a JSON-stringified array of strings.

For regular expressions (regex and notRegex operators), use the RE2 syntax.

StringRequired

Compare against a regular string:

Code Block
languagejs
themeRDark
"operatorvalue": "!="
value

Value against which the value of the product attribute defined in attribute is compared.

The value can be either a regular string or, if the operator is in or notIn, a JSON-stringified array.

StringRequired

Compare against a regular string:

Code Block
languagejs
themeRDark
"value": "Books"

Compare against a JSON-stringified array:

Code Block
languagejs
themeRDark
"value": "[\"Books\",\"Magazines\"]"
Books"

Compare against a JSON-stringified array of strings:

Code Block
languagejs
themeRDark
"value": "[\"Books\",\"Magazines\"]"


Filter rule operators

The following table describes the relational operators supported in filter rules. The Product attribute types column lists the types of product attribute values with which you can use the operators. For example, the = operator is valid for product attributes that are Booleans, numbers, or strings.

Table: Supported filter rule operators

OperatorProduct attribute typesNotes
=
  • Boolean
  • Number
  • String

!=
  • Boolean
  • Number
  • String

<
  • Number
  • String
If the product attribute is a number, the platform treats the attribute and the target value as numbers for the comparison.
>
  • Number
  • String
If the product attribute is a number, the platform treats the attribute and the target value as numbers for the comparison.
<=
  • Number
  • String
If the product attribute is a number, the platform treats the attribute and the target value as numbers for the comparison.
>=
  • Number
  • String
If the product attribute is a number, the platform treats the attribute and the target value as numbers for the comparison.
contains
  • String

notContains
  • String

startsWith
  • String

startsWithAny
  • String
The target value must be a JSON-stringified array of strings. For example: "[\"Books\",\"Magazines\"]"
endsWith
  • String

in
  • Boolean
  • Number
  • String

The target value must be a JSON-stringified array of strings. For example:

  • "[\"true\"]"
  • "[\"1\",\"2\"]"
  • "[\"Books\",\"Magazines\"]"

The platform converts the attribute value to a string for the comparison.

notIn
  • Boolean
  • Number
  • String

The target value must be a JSON-stringified array of strings. For example:

  • "[\"true\"]"
  • "[\"1\",\"2\"]"
  • "[\"Books\",\"Magazines\"]"

The platform converts the attribute value to a string for the comparison.

arrayIncludes
  • Array of Booleans
  • Array of numbers
  • Array of strings
The platform expects the elements of an array to be of the same type.
arrayNotIncludes
  • Array of Booleans
  • Array of numbers
  • Array of strings
The platform expects the elements of an array to be of the same type.
anyElementContains
  • Array of Booleans
  • Array of numbers
  • Array of strings
The platform expects the elements of an array to be of the same type.
anyElementStartsWith
  • Array of Booleans
  • Array of numbers
  • Array of strings
The platform expects the elements of an array to be of the same type.
anyElementEndsWith
  • Array of Booleans
  • Array of numbers
  • Array of strings
The platform expects the elements of an array to be of the same type.
regex
  • String

notRegex
  • String

Filter examples

Here are some examples showing how to create filters with different operators and how those filters get evaluated:

...

Code Block
languagejs
themeRDark
titleExample: Return any item one whose categories starts with "slot"
collapsetrue
"filters": [{
    "name": "Include items from categories whose name starts with 'slot'",
    "rules": [{
        "attribute": "categories",
        "operator": "anyElementStartsWith",
        "value": "slot"
    }]
}]

// Evaluation examples:
// "categories": ["jackpot","slots"] -> TRUE
// "categories": ["jackpot","slot"] -> TRUE
// "categories": ["poker","stud"] -> FALSE

Filter examples: regex, notRegex

Info

The platform supports the RE2 syntax for regular expressions.

...

Code Block
languagejs
themeRDark
{
  "id": 2030,
  "site_id": 2094,
  "name": "Most viewed affordable shirts",
  "description": "Top 5 most viewed shirts in the past 14 days that cost less than 30.00",
  "type": "most_viewed",
  "status": "success",
  "duration": 1,
  "frequency": "1d",
  "hours": 336,
  "limit": 5,
  "params": [
    "category",
    "brand"
  ],
  "map_ids": "product",
  "options": {
    "product_attrs": [
      "type",
      "manufacturerbrand"
    ]
  },
  "model": null,
  "error": "",
  "created_at": "2020-09-14T08:15:31+00:00",
  "updated_at": "2020-10-08T15:45:59+00:00",
  "model_updated_at": "2020-10-08T15:45:48+00:00",
  "model_version": 2,
  "filters": [
    {
      "name": "Include shirts that cost less than 30.00",
      "rules": [
        {
          "attribute": "category",
          "operator": "contains",
          "value": "shirt"
        },
        {
          "attribute": "price",
          "operator": "<",
          "value": "30.00"
        }
      ]
    }
  ]
}

...

Table: Supported recommendation algorithms

NameTypeDescription
Most purchased productsmost_convertedProducts that have been purchased the most.
Most viewed productsmost_viewedProducts that have received the most views.
Products purchased togetherbundle_convertedVisitors who purchased product A also purchased products B, C, and so on.
Products viewed togetherbundle_viewedVisitors who viewed product A also viewed products B, C, and so on.
Products viewed and purchased togetherbundle_viewed_convertedVisitors who viewed and purchased product A also viewed and purchased products B, C, and so on.

While you can, in principle, use Frosmo Recommendations to generate recommendations from any data and using any recommendation algorithm, the system currently provides built-in support only for product recommendations based on the algorithms listed above. If you want to create other types of recommendations, contact Frosmo support.

...

Table: Mapping recommendation types to data layer objects

Recommendation typeSource usage dataData layer object
Most purchased productsTransactionTransaction
Most viewed productsProduct dataProduct
Products purchased togetherTransactionTransaction
Products viewed togetherProduct dataProduct
Products viewed and purchased together

Product data

Transaction

Product

Transaction