Appearance
Context Values
Context Values are string Key/value pairs included in a Search or Recommendation API request. They describe the context of that request so that merchandising rules can apply to a particular campaign, device type, or other situation.
For example, a request can include Campaign=SummerSale and DeviceType=Mobile. A rule can then boost selected Products only for mobile requests in that campaign. You choose these values and send them with the request; Relewise does not infer them automatically.
Choose the right data
| Data | Purpose |
|---|---|
| Context Values | Per-request metadata for deciding which merchandising rules apply. |
| User Classifications | User-related information used for segmentation and personalization. |
| User Identifiers | Information that identifies a User. |
| User Data | Custom attributes stored on a User. |
| Catalog Data Values | Attributes stored on Products, Content, and other catalog entities. |
Context Values apply to the current request and are not saved as User Data or User Classifications. Supply them on each request that needs them, or use batch defaults. Keep values focused on the request and avoid sensitive information: they are visible in My Relewise Live View.
Supply values on a request
Add ContextValues to the request alongside its other properties. This JSON example searches for shirts in the context of a mobile summer campaign:
json
{
"$type": "Relewise.Client.Requests.Search.ProductSearchRequest, Relewise.Client",
"Language": { "Value": "en" },
"Currency": { "Value": "USD" },
"DisplayedAtLocation": "Search",
"Term": "shirt",
"Skip": 0,
"Take": 10,
"ContextValues": {
"Campaign": "SummerSale",
"DeviceType": "Mobile"
}
}To act on these values, configure a matching merchandising condition in My Relewise and choose the rule's target entities and action.
Batch defaults and request overrides
A Search batch or Recommendation batch can supply ContextValues at the collection level. Each member inherits those defaults and can override individual Keys. Keys supplied only by the member are added to its effective values.
json
{
"$type": "Relewise.Client.Requests.Search.SearchRequestCollection, Relewise.Client",
"Language": { "Value": "en" },
"Currency": { "Value": "USD" },
"DisplayedAtLocation": "Search",
"ContextValues": {
"Campaign": "SummerSale",
"DeviceType": "Mobile"
},
"Requests": [
{
"$type": "Relewise.Client.Requests.Search.ProductSearchRequest, Relewise.Client",
"Term": "shirt",
"Skip": 0,
"Take": 10
},
{
"$type": "Relewise.Client.Requests.Search.ContentSearchRequest, Relewise.Client",
"Term": "summer",
"Skip": 0,
"Take": 5,
"ContextValues": { "Campaign": "SummerEditorial" }
}
]
}The Product Search inherits Campaign=SummerSale and DeviceType=Mobile. The Content Search uses Campaign=SummerEditorial and still inherits DeviceType=Mobile. Omitting a member's dictionary, setting it to null, or supplying {} retains the defaults; an empty dictionary does not clear them.
Matching and limits
Keys and values match exactly and are case-sensitive: Mobile differs from mobile, and Campaign differs from campaign. A condition matches only when the request supplies every configured Key with an accepted value. Each Key can accept multiple alternative values. See Request Conditions for combining conditions and alternative groups.
Dataset settings control the limits. The defaults are 10 effective Keys per request after merging batch defaults, 36 characters per Key, and 36 characters per value. A matching condition defaults to at most 10 Keys and 10 accepted values per Key, including duplicates. Keys must contain a non-whitespace character and values must be non-null strings.
Rules edited in My Relewise also follow its fixed limits.
Inspect effective values
In Live View, expand Context Values under Input to inspect the effective values for a Search or Recommendation request, including inherited defaults and member overrides. Expand Classifications under User to inspect User Classifications separately.