The Recommendation API gives you direct access to Recommendations.
This is intended for backend usage to expose your data if used from a frontend implementation.
There are 2 parts linked to the integration of Recommendations:
By enabling the Recommendations module, you can leverage the automatic installation of the Recommendations tracking JS script, via the SITE JS script tag.
The Recommendations JS tag will collect relevant interactions of users with the customer website like: page views, clicks, add-to-carts, ... The interactions are the most valuable information for the algorithms in Recommendations recommendation engine. These interactions are captured automatically.
For requesting and showing recommendations, Recommendations provides an integration for the web which consist out of three principal options:
This documentation focuses on the Recommendations REST API, for more information on the other implementations reach out to your Marigold Engage contact.
Recommendations uses a wide range of information to make recommendations. The AI engine can make personalised recommendations but to be able to do this, it is required to properly identify the user.
The user identities & identification are provided by Marigold Engage SITE product. You cannot use your own customer identifiers when requesting personalised recommendations from Recommendations, but you can use the Site profile identifiers when communicating with Recommendations.
To be able to request personalised recommendations, follow this 2-step process:
A typical situation is when you have an internal user reference.
In the example below, we will use a "user_ID" with reference 99999
.
By doing a Site profile lookup, you can get the Marigold Engage profile reference back. The step below uses the API to lookup a Site profile. All the details for the Site endpoint can be found under the Site Identifcation section.
POST https://site-azp.slgnt.eu/frontend/api/track
with the following JSON properties in the request body:
{
"universeId": "123e4567-e89b-12d3-a456-426614174000",
"customIdentifier": "99999",
"referer": "https://www.google.be/",
"isEvent": true,
"isIdentificationRequest": true,
"isTargeting": false
}
Important to know are the properties:
universeId
: refers to your instance setup for Site, which is can found in the Site configuration.customIdentifier
: refers to the internal user reference, which would be the "user_ID" 12345
from exampleThe response body would contain the following information:
{
"profileId": "123ABCD45678iY2Q0LWJhNGE4NjFkNzFkMDNmI3MjdjNzYtMWQ2ZC00NTZkL",
"profileInfo": { },
"doNotTrack": false,
"$$profileId": "abc12345-ae74-a40ad",
"$$thirdPartyId": "a123456789"
}
From the Site profile response, you need to extract the $$profileId
and the $$thirdPartyId
.
By passing these properties you can request Recommendations to return personalised recommendations.
In the recommendations API you can pass the Site profile properties, by mapping the sid
& tpid
.
GET https://offer.slgnt.eu/api/abc123456/r?widgetid=demo&sid=abc12345-ae74-a40ad&tpid=a123456789&lang=nl&loc=be
$$thirdPartyId
is mapped to the Marigold Engage system ID of the contact tpid
(Required)$$profileId
is mapped to the Site profile ID reference sid
(Optional)All the options and properties for the Recommendations recommendations endpoints can be found under the Smart Content Recommendations Identifcation section.
The Recommendation API can be reached from multiple domains, each specific to a region. You should use the domain that matches the region where your data is stored and processed. You can use one of the following domains:
Structure:
https://domain/api/{customer}/operation?params
Example:
https://offer.slgnt.eu/api/abc123456/r?widgetid=demo&lang=nl&loc=be
Definition:
The API is publicly available without credentials.
By passing the accept-format
you can define the content negotiation and the Recommendations engine will respond in
the desired format.
When the accept-format
is not passed along, the API will respond with in the HTML format.
Supported content negotiation:
The response format will respect the accept-format
to respond the data in the requested format.
Whether a request succeeded is indicated by the HTTP status code. A 2xx status code indicates success, whereas a 4xx or 5xx status code indicates failure.
When a request fails, the response body is still JSON, but always contains the field message which you can inspect for debugging purposes.
The response will contain a set of fixed properties (see endpoint documentation), which can be extended by any field that is available in the catalog.
By marking the "This field will be sent with the API responses as", this field will be included in the JSON response as a property of the recommendation item object.
It is even possible to specify a custom property name, like in the example below, where the catalog field PRODUCT
will be returned as the property TITLE
.
The Recommendations API is versioned to allow versions with new functionality or changes be released without impact of existing implementations.
When we make improvements to the current version of the API endpoints, we strive to make only backwards-incompatible changes. We release regularly improvements or new endpoints. Read our API changelog to stay up-to-date with the latest changes.
You can modify the accept header to specify a version, for example:
curl -L "https://offer.slgnt.eu/api/abc123456/r?widgetid=demo&lang=nl&loc=be"
-H "accept: application/json;version=1"
Which will respond with the content format of version=1
and with the response format application/json
.
The version parameter is optional. By not specifying the version, the latest version will be used.
Engage uses the conventional HTTP response codes to indicate successful or failed API requests.
Codes in the 2xx
range indicate success.
Codes in the 4xx
range indicate an input related error or validation restrictions.
Codes in the 5xx
range indicate an error with Marigold Engage servers.
HTTP Status Codes | Description |
---|---|
200 - OK | We found the request resource |
201 - Created | The resource is successfully created |
204 - No Content | The requested resources is empty |
400 - Bad Request | There was an error with the request. The body of the response will have more info. |
401 - Unauthorized | The access key was incorrect |
404 - Not found | The resources cannot be found |
405 - Method Not Allowed | The method is not allowed |
408 - Request Timeout | The request is taking too long to respond |
422 - Unprocessable Entity | The resource couldn't be created |
429 - Too Many Requests | Too many requests hit the API too quickly |
5xx - Server errors | Something went wrong on our end. Please try again |
Get top-N items recommendations.
The most typical use cases are recommendations at overview pages like a homepage or category pages.
customerId required | string <guid> Example: 1234567890 ID of the customer. This refers to the uniquer customer property, which is be defined during the customer activation within Recommendations'. |
widgetid required | string Example: widgetid=6f390e664f8c4657b8f88212e98099e1 The widget ID refers to the Smart Content configuration. The configuration decides which algorithm & filter conditions will be used for the recommendations prediction. |
lang required | string Example: lang=nl The |
loc | string Example: loc=be The |
accept | string Default: application/json;version=1 The response format for the data that will be returned. |
item_pid required | string The unique ID for this item within Recommendations. |
score required | integer <int64> The recommendation score that Recommendations has calculated. The higher the number the better the match. |
tracking_url required | string The redirect URL to the item, which is used for reporting views & click. |
item_url | string The public URL of the item |
[- {
- "item_pid": "SKU-12",
- "score": 5,
- "first_category": "Women Clothing",
- "cat_id": [
- "250"
]
}, - {
- "item_pid": "SKU-15",
- "score": 4,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}, - {
- "item_pid": "SKU-5",
- "score": 3,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}
]
Based on user’s past interactions (purchases, view, etc.) with the items, recommends top-N items that are most likely to be of high value for a given user.
The most typical use cases are recommendations at overview pages like a homepage or category pages.
customerId required | string <guid> Example: 1234567890 ID of the customer. This refers to the uniquer customer property, which is be defined during the customer activation within Recommendations'. |
widgetid required | string Example: widgetid=6f390e664f8c4657b8f88212e98099e1 The widget ID refers to the Smart Content configuration. The configuration decides which algorithm & filter conditions will be used for the recommendations prediction. |
tpid required | integer <int32> Example: tpid=123456789 The Marigold Engage system ID of the contact who will see the recommendations. |
sid | string Example: sid=abc12345-ae74-40ad-a9df-9c9107cdf6c8 The Marigold Engage Site profile ID reference. |
lang required | string Example: lang=nl The |
loc | string Example: loc=be The |
accept | string Default: application/json;version=1 The response format for the data that will be returned. |
item_pid required | string The unique ID for this item within Recommendations. |
score required | integer <int64> The recommendation score that Recommendations has calculated. The higher the number the better the match. |
tracking_url required | string The redirect URL to the item, which is used for reporting views & click. |
item_url | string The public URL of the item |
[- {
- "item_pid": "SKU-12",
- "score": 5,
- "first_category": "Women Clothing",
- "cat_id": [
- "250"
]
}, - {
- "item_pid": "SKU-15",
- "score": 4,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}, - {
- "item_pid": "SKU-5",
- "score": 3,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}
]
Get recommendations for a specific item.
The typical use-case is to offer "related items" or "compatible items" in relation to the specified item.
The returned items are sorted by relevance (first item being the most relevant).
customerId required | string <guid> Example: 1234567890 ID of the customer. This refers to the uniquer customer property, which is be defined during the customer activation within Recommendations'. |
itemPid required | string Example: 1234567890 The item/product ID, like it is referenced by the customer. Typically this is like the item SKU or another unique reference to the item. The ID of the item for which the recommendations are to be generated. |
item required | string Example: aHR0cHM6Ly93d3cuc2VsbGlnZW50LmNvbS9wbGF0Zm9ybS9jYXBhYmlsaXRpZXMvYWktbWFjaGluZS1sZWFybmluZw== The base64 encoded page URL of the item/product. The URL reference of the item for which the recommendations are to be generated. |
widgetid required | string Example: widgetid=6f390e664f8c4657b8f88212e98099e1 The widget ID refers to the Smart Content configuration. The configuration decides which algorithm & filter conditions will be used for the recommendations prediction. |
lang required | string Example: lang=nl The |
loc | string Example: loc=be The |
accept | string Default: application/json;version=1 The response format for the data that will be returned. |
item_pid required | string The unique ID for this item within Recommendations. |
score required | integer <int64> The recommendation score that Recommendations has calculated. The higher the number the better the match. |
tracking_url required | string The redirect URL to the item, which is used for reporting views & click. |
item_url | string The public URL of the item |
[- {
- "item_pid": "SKU-12",
- "score": 5,
- "first_category": "Women Clothing",
- "cat_id": [
- "250"
]
}, - {
- "item_pid": "SKU-15",
- "score": 4,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}, - {
- "item_pid": "SKU-5",
- "score": 3,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}
]
Get personalised recommendations for a specific item.
The typical use-case is to offer "related items" or "compatible items" in relation to the specified item, which includes the past preference of the visitor.
The returned items are sorted by relevance (first item being the most relevant).
customerId required | string <guid> Example: 1234567890 ID of the customer. This refers to the uniquer customer property, which is be defined during the customer activation within Recommendations'. |
itemPid required | string Example: 1234567890 The item/product ID, like it is referenced by the customer. Typically this is like the item SKU or another unique reference to the item. The ID of the item for which the recommendations are to be generated. |
item required | string Example: aHR0cHM6Ly93d3cuc2VsbGlnZW50LmNvbS9wbGF0Zm9ybS9jYXBhYmlsaXRpZXMvYWktbWFjaGluZS1sZWFybmluZw== The base64 encoded page URL of the item/product. The URL reference of the item for which the recommendations are to be generated. |
widgetid required | string Example: widgetid=6f390e664f8c4657b8f88212e98099e1 The widget ID refers to the Smart Content configuration. The configuration decides which algorithm & filter conditions will be used for the recommendations prediction. |
tpid required | integer <int32> Example: tpid=123456789 The Marigold Engage system ID of the contact who will see the recommendations. |
sid | string Example: sid=abc12345-ae74-40ad-a9df-9c9107cdf6c8 The Marigold Engage Site profile ID reference. |
lang required | string Example: lang=nl The |
loc | string Example: loc=be The |
accept | string Default: application/json;version=1 The response format for the data that will be returned. |
item_pid required | string The unique ID for this item within Recommendations. |
score required | integer <int64> The recommendation score that Recommendations has calculated. The higher the number the better the match. |
tracking_url required | string The redirect URL to the item, which is used for reporting views & click. |
item_url | string The public URL of the item |
[- {
- "item_pid": "SKU-12",
- "score": 5,
- "first_category": "Women Clothing",
- "cat_id": [
- "250"
]
}, - {
- "item_pid": "SKU-15",
- "score": 4,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}, - {
- "item_pid": "SKU-5",
- "score": 3,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}
]
Recommends set of items that are related to passed contex. The items returned are selected and sorted based on the relevance for the provided context.
The returned items are sorted by relevance (first item being the most relevant).
customerId required | string <guid> Example: 1234567890 ID of the customer. This refers to the uniquer customer property, which is be defined during the customer activation within Recommendations'. |
item required | string Example: aHR0cHM6Ly93d3cuc2VsbGlnZW50LmNvbS9wbGF0Zm9ybS9jYXBhYmlsaXRpZXMvYWktbWFjaGluZS1sZWFybmluZw== The base64 encoded page URL of the item/product. The URL reference of the item for which the recommendations are to be generated. |
widgetid required | string Example: widgetid=6f390e664f8c4657b8f88212e98099e1 The widget ID refers to the Smart Content configuration. The configuration decides which algorithm & filter conditions will be used for the recommendations prediction. |
lang required | string Example: lang=nl The |
loc | string Example: loc=be The |
accept | string Default: application/json;version=1 The response format for the data that will be returned. |
item_pid required | string The unique ID for this item within Recommendations. |
score required | integer <int64> The recommendation score that Recommendations has calculated. The higher the number the better the match. |
tracking_url required | string The redirect URL to the item, which is used for reporting views & click. |
item_url | string The public URL of the item |
[- {
- "item_pid": "SKU-12",
- "score": 5,
- "first_category": "Women Clothing",
- "cat_id": [
- "250"
]
}, - {
- "item_pid": "SKU-15",
- "score": 4,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}, - {
- "item_pid": "SKU-5",
- "score": 3,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}
]
Recommends set of items that are related to passed "contex", where the past history of a user is taken into account, allowing personalised recommendations. The items returned are selected and sorted based on the relevance for the provided user and context.
The returned items are sorted by relevance (first item being the most relevant).
customerId required | string <guid> Example: 1234567890 ID of the customer. This refers to the uniquer customer property, which is be defined during the customer activation within Recommendations'. |
item required | string Example: aHR0cHM6Ly93d3cuc2VsbGlnZW50LmNvbS9wbGF0Zm9ybS9jYXBhYmlsaXRpZXMvYWktbWFjaGluZS1sZWFybmluZw== The base64 encoded page URL of the item/product. The URL reference of the item for which the recommendations are to be generated. |
widgetid required | string Example: widgetid=6f390e664f8c4657b8f88212e98099e1 The widget ID refers to the Smart Content configuration. The configuration decides which algorithm & filter conditions will be used for the recommendations prediction. |
tpid required | integer <int32> Example: tpid=123456789 The Marigold Engage system ID of the contact who will see the recommendations. |
sid | string Example: sid=abc12345-ae74-40ad-a9df-9c9107cdf6c8 The Marigold Engage Site profile ID reference. |
lang required | string Example: lang=nl The |
loc | string Example: loc=be The |
accept | string Default: application/json;version=1 The response format for the data that will be returned. |
item_pid required | string The unique ID for this item within Recommendations. |
score required | integer <int64> The recommendation score that Recommendations has calculated. The higher the number the better the match. |
tracking_url required | string The redirect URL to the item, which is used for reporting views & click. |
item_url | string The public URL of the item |
[- {
- "item_pid": "SKU-12",
- "score": 5,
- "first_category": "Women Clothing",
- "cat_id": [
- "250"
]
}, - {
- "item_pid": "SKU-15",
- "score": 4,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}, - {
- "item_pid": "SKU-5",
- "score": 3,
- "first_category": "Men Clothing",
- "cat_id": [
- "270"
]
}
]
Get the SITE profile identify based on an internal customer identifier.
origin | string Example: https://www.example.com Domain that is defined in the SITE universe settings (normally domain from the website). |
universeId required | string Site Universe reference |
customIdentifier required | string A custom identifier by which the user is uniquely defined. Typically, this will be a value by which you will be able to recognize users (for instance login id or guid). |
isEvent required | boolean Default: true Whether the tracking call represents an event on the website instead of a page visit. |
isIdentificationRequest required | boolean Default: true Whether the tracking call is used for identification (which is the main reason of API request). |
isTargeting required | boolean Default: false Whether the tracking call is used for targeting (which is not the case for the recommendations API request). |
profileId required | string The unique ID for this profile within Site. |
profileInfo | object The full Site profile, containing offers, tags, ... . |
$$profileId required | string The Marigold Engage Site identified profile ID reference. |
$$thirdPartyId required | string The Marigold Engage system ID of the user who will see the recommendations. |
{- "universeId": "123e4567-e89b-12d3-a456-426614174000",
- "customIdentifier": "1234567abc123",
- "isEvent": true,
- "isIdentificationRequest": true,
- "isTargeting": false
}
{- "profileId": "123ABCD45678iY2Q0LWJhNGE4NjFkNzFkMDNmI3MjdjNzYtMWQ2ZC00NTZkLThhYzYtYzQ1ZGM2ZTRmYjg4OzczMTY4OTszNjIsz",
- "profileInfo": {
- "universeId": "123e4567-e89b-12d3-a456-426614174000",
- "customIdentifier": "1234567abc129",
- "isEvent": true,
- "isIdentificationRequest": true,
- "isTargeting": false
}, - "doNotTrack"": false,
- "$$profileId": "abc12345-ae74-40ad-a9df-9c9107cdf6c8",
- "$$thirdPartyId": "123456789"
}