API
This page contains the API definition. See tab Interfaces for information on how to use the API.
Methods
Optional arguments denoted with square brackets.
Return Method Description JavaScript Arguments JSON Arguments
Predictions getClickstream Returns the products in the current session's clickstream. TemplateName [DynamicParameters] [ColumnNames] SessionID TemplateName [DynamicParameters] [ColumnNames]
Predictions getRecommendations A generic method for returning recommendations. The type of recommendation returned is governed by the template. TemplateName Input [DynamicParameters] [ColumnNames] SessionID TemplateName Input [DynamicParameters] [ColumnNames]
Status logAddedToCart Logs the event that a user adds a product to the shopping cart. If the product is a recommended product, then the TrackingCode argument should be used. If it is a non-recommended product, then TrackingCode should not be used. ProductID [TrackingCode] SessionID ProductID [TrackingCode]
Status logClickedOn Logs the event that a user clicks on a predicted product. Also collects clickstream data and click data. ProductID TrackingCode SessionID ProductID TrackingCode
Status logPurchase Logs the event that a user makes a purchase. UserID ProductIDs Prices [OrderID] [Currency] SessionID UserID ProductIDs Prices [OrderID] [Currency]
Status logRemovedFromCart Removes a product previously logged as added to cart with method logAddedToCart. Affects recommendations filtered out with the setting Exclude Added to Cart and recommendations based on the content of the cart when the content is derived from the SessionID. Does not affect metrics. ProductID SessionID ProductID
Status registerSession Registers a session. Not available in JavaScript SessionID
Status saveLandingPageData Saves a landing page phrase. Predictions for landing pages are based on these. SearchPhrase ProductID SearchPhrase ProductID
Status saveSearch Saves a search to the server. Predictions for searches are based on these. SearchPhrase ProductID SearchPhrase ProductID
Status setProductValidity Sets if a specific product can be recommended or not. Invalid products are filtered out by using a template with the Only Valid setting set to True Not available in JavaScript ProductID Valid
Deprecated Methods
Optional arguments denoted with square brackets.
As of 2010-11-23 the preferred way to do recommendations requests is via the method getRecommendations.
Return Method Description JavaScript Arguments JSON Arguments
Predictions getCartPredictions Deprecated. Returns predictions based on the products in a shopping cart. ProductIDs TemplateName [DynamicParameters] [ColumnNames] SessionID ProductIDs TemplateName [DynamicParameters] [ColumnNames]
Predictions getClickstreamPredictions Deprecated. Returns predictions based on the current session's clickstream. TemplateName [DynamicParameters] [ColumnNames] SessionID TemplateName [DynamicParameters] [ColumnNames]
Predictions getLandingPagePredictions Deprecated. Returns predictions for a search phrase used on an external web search engine. SearchPhrase TemplateName [DynamicParameters] [ColumnNames] SessionID SearchPhrase TemplateName [DynamicParameters] [ColumnNames]
Products getProducts Deprecated. Returns products. Used to choose what products to display. TemplateName [DynamicParameters] [ColumnNames] TemplateName [DynamicParameters] [ColumnNames]
Predictions getProductsPredictions Deprecated. Returns predictions for one or more products. When the input contains only one product it also collects clickstream data and click data. ProductIDs TemplateName [DynamicParameters] [ColumnNames] SessionID ProductIDs TemplateName [DynamicParameters] [ColumnNames]
Predictions getProductsPredictionsFromClicks Deprecated. Returns predictions for one or more products. When the input contains only one product it also collects clickstream data and click data. ProductIDs TemplateName [DynamicParameters] [ColumnNames] SessionID ProductIDs TemplateName [DynamicParameters] [ColumnNames]
Predictions getSearchPredictions Deprecated. Returns predictions for a search phrase. SearchPhrase TemplateName [DynamicParameters] [ColumnNames] SessionID SearchPhrase TemplateName [DynamicParameters] [ColumnNames]
Predictions getTwinsumers Deprecated. Returns users that have a similar order history as the given user. UserID NrToReturn SessionID UserID NrToReturn
Predictions getUserPredictions Deprecated. Returns predictions for a user. UserID TemplateName [DynamicParameters] [ColumnNames] SessionID UserID TemplateName [DynamicParameters] [ColumnNames]
Arguments
Name Primitive Description
ColumnNames String[] The names of the product data columns to return.
Currency AlphNumString A three letter code denoting a currency according to ISO 4217 standard (USD, EUR, SEK, DKK, etc.). See Wikipedia for details about ISO 4217.
DynamicParameters String[] Each position in the array is a dynamic parameter. Dynamic parameter syntax: "[append/replace] [andcat/orcat/notcat/rule] in subtemplate [subtemplate number] with [data]". To apply a dynamic parameter to all subtemplates use ALL instead of a number. Note that if you append to an existing rule you have to add and or or to the beginning of the added rule.
Generic example: "append rule in subtemplate 2 with and Price<10". Example: "replace notcat in subtemplate 1 with Hardback". Multiple categories can be passed in one dynamic parameter separated with comma: Generic example: "replace andcat in subtemplate 3 with Drama,DVD,OnSale". Please see interfaces for interface specific syntax on dynamic parameters.
Input String[] The elements of the array are key-value pairs where key and value are separated by a colon. Valid keys are 'ProductId', 'ProductIds', 'UserId' and 'Phrase'. Example: "Phrase:Harry Potter". SessionId is sent in automatically and is thus an available argument to base recommendations on. The implicit SessionId is derived from the argument SessionId which is handled automatically in JavaScript. The implicit SessionId can be overridden by using the key 'SessionId'. Please see Interfaces for specific input syntax.
NrToReturn A whole number between 0 and 2,147,483,647. The maximum number of elements to return.
OrderID AlphNumString A unique order identifier of an order as used in the implementing system.
Prices AlphNumString[] Array of prices that is purchased. Dot denotes decimal. Must be in the same order as the products. Must not be empty. Do not include taxes, shipment and handling or other charges outside the actual product price. All prices submitted must be in the same currency.
ProductID AlphNumString A unique identifier of a product.
ProductIDs AlphNumString[] A unique identifier of a product.
SearchPhrase String The complete search phrase that the user entered into the search field. Must not be empty.
SessionID AlphNumString A unique session identifier as used in the implementing system. JSON session identifier is retrieved from the __avail_session__ browser cookie.
TemplateName AlphNumString The name of the template.
TrackingCode AlphNumString Server generated tracking code. The tracking code is returned from server with a predictions request.
UserID AlphNumString A unique identifier of a user.
Valid Boolean Changes the validity of a product.
Returns
Predictions
  • In the values variable an ordered list of products or user identifiers is returned. The most highly ranked result first, then in descending order.
  • In the trackingcode variable the tracking code for the current predictions request is returned.
    Products
  • In the values variable a list of products is returned. The products returned are based on Column to Sort On and Sort Order. Sort On and Sort Order are set on the template.
  • Status
    The values variable hold the status of the operation.
    Primitives
    Name Description
    AlphNumString Allowed characters in AlphNumString are the alphanumeric characters and underscore, at sign, full stop and hyphen-minus. The alphanumeric character set consists of the numbers 0 to 9 and letters A to Z in the English alphabet case-sensitive. The maximum length is 500 characters.
    AlphNumString[] Allowed value is an array of AlphNumString. The maximum length of the array is 10000 elements.
    Boolean Has only two possible values: true and false.
    String Allowed values are arbitrary characters. Reserved values are the null value 'null' and the crypto prefix '_enc_'. The maximum length is 500 characters.
    String[] Allowed value is an array of Strings. The maximum length of the array is 10000 elements.