recsForPlacements API

Description

This endpoint returns recommendations for a named placement and logs shopper behavior. The recommendations returned by the API respect all merchandising rules set up in the Algonomy Cloud dashboard.

URL

Production

Note: As part of the personalization cloud’s initiative to move towards a privacy-first solution, the platform is migrating to an exclusive data capture domain called https://recs.algorecs.com to manage the interactions directly with web browsers.

Use this URL to request personalization from your production environment.

Copy
https://recs.algorecs.com/rrserver/api/rrPlatform/recsForPlacements

Integration

Use this URL to request personalization from your QA, staging or development environment. This way, you can test changes (such as merchandising or strategy rules) without impacting your production environment.

Copy
https://integration.algorecs.com/rrserver/api/rrPlatform/recsForPlacements

Parameters

    Notes:
  • You need only call parameters.

  • Algonomy operates off a set of APIs that support many applications and clients concurrently. Algonomy may update and enhance these APIs at any time. 
  • All parameters are case sensitive.

This endpoint requires that you track click events.

For more information about how to track click events, see Tracking Events 

Core Integration Parameters (All Requests)

Parameters that must be included on every API request to authenticate, identify the client, and ensure the recommendation engine functions correctly.

Parameter Name Required or Optional Description
ts Optional (best practice)

Timestamp. It's used for browser cache busting, and is highly recommended. If excluded, you may see cached responses.

Example: ts=1376676943

apiClientKey Required

A unique key specific to each API implementation. It identifies the specific application or client for reporting, permissions, and merchandising. This is provided by Algonomy.

Example: apiClientKey=b0126f995ac848159d

apiKey Required

A unique key that identifies the site. Each Algonomy client has a unique API key to separate data and traffic from other clients. This is provided by Algonomy.

Example: apiKey=4faeaf752ee40a0f

placements Required

List of placement identifiers. Each identifier consists of a page type and a placement name. The identifiers are separated by the pipe "|" character.

You'll receive one set of recommendations per placement.

All placements must be for the same page type.

The first placement is assumed to be the "best" placement, and will receive the best recommendation strategy.

When multiple placements are requested, each will receive a unique strategy and unique products.

Example: placements=item_page.horizontal|item_page.vertical

rcs Required

Algonomy Cookie String. This is the encrypted Algonomy cookie for the user associated with the API request. It should be passed exactly as it was received in a prior API response.

Clients should ensure to preserve the 'rcs' value just as it was served. The 'rcs' parameter is always alphanumeric and case-sensitive, with the token value including a mix of uppercase letters, lowercase letters, and numbers.

Note: The 'rcs' parameter allows merchants to effectively provide the Algonomy platform access to a user's Algonomy browser cookie by acting as a cookie proxy (or cookie pass-through). This process involves the merchant reading and writing a user's Algonomy browser cookie and passing it to and from Algonomy via the server-side API.

sessionId Required

Identifies a single visit by a shopper. Sessions are used by behavioral models (to scope user behaviour in a shopping session) and reporting metrics.

Example: sessionId=93484

userId Required when the user is logged in or recognized via soft-login

User ID. A unique string to identify each shopper (user). All shopper behavior is stored using this key. It is case-sensitive, and should be the same user ID sent to Algonomy in other applications.

Example: userId=0982347

lang Optional. Used if languages are decoupled from regions Identify the language requested using the language code.
rid Optional

Region ID. Must be consistent with the ID used in the Product Region Feed.

Example: rid=Switzerland-France

privm Optional

True/false. If set to true, privacy mode is enabled for the request. In privacy mode, user affinity data is ignored, and recommendations are generated without personalization based on behavioral data. This ensures that recommendations respect user consent preferences and do not use behavioral data for users who decline tracking.

Example: privm=true

Contextual Parameters (Page Context)

Parameters that provide contextual information about the current page, including product(s), category, or search term, to generate relevant recommendations.

Parameter Name Required or Optional Description
atcid Required on add_to_cart_page

Add to cart ID. This can be a single product ID or a list of product IDs. If more than one product is added to the cart, separate the product IDs by using the pipe "|" character.

Example: atcid=uv2345|xt1234

categoryId Required on category_page

The category ID of the category the merchant wants to investigate. The value must match the external ID provided by the merchant to Algonomy for the category.

Example: categoryId=902312

wlName Optional on wish_list_page The name of the wishlist to which the action applies. Defaults to null
wlAction Required on wish_list_page

Specifies the action being performed on the wishlist.

Values: ADD, VIEW, REMOVE.

cvAction Required on cart_page

Indicates the action performed on the cart. This parameter specifies the type of cart event being tracked.

Possible value is REMOVE.

pp

Required on purchase_complete_page

Optional on cart_page

Product prices. A list defining the prices of purchased products. The index of product prices in the list corresponds to the products passed in productId. This is part of the order definition. Use either pp or ppc to define the price of items purchased. If you use pp, the site’s currency multiplier is applied. The values are separated by the pipe "|" character.

Example: pp=29.99|32.97

ppc

Required on purchase_complete_page

Optional on cart_page

Product prices in cents. A list defining the prices of purchased products. The index of product prices in the list corresponds to the products passed in productId. This is part of the order definition. Use either pp or ppc to define the price of items purchased. If you use ppc, the site’s currency multiplier is not applied.

The passed value is accepted as-is, and is converted from a string to an integer. Be certain that the string you pass contains only numerals (no currency symbols or separators). The values are separated by the pipe "|" character.

Example: ppc=2999|3297 (these values are $29.99 and $32.97)

productId

Required on item_page, purchase_complete_page, wish_list_page and cart_page (when not empty)

Optional on category_page, search_page

A single product ID, or a list of product IDs. Part of an order definition on the purchase complete page. Use the pipe "|" character to separate the product IDs.

Example: productId=uv2345|xt1234

Note: For the add_to_cart_page request, the product ID is passed as the Add to Cart ID through the'atcid' parameter. Hence this producId field is not required.

Note: SKU IDs can be passed to API calls as well. When specifying a PRODUCT ID, the SKU ID should be appended with a tilde ('~') separator. Example: ...&productId=[product_id]~[sku_id]

q

Required on purchase_complete_page

Optional on cart_page

Item quantities. A list defining the quantities of products purchased. The index of quantities in the list corresponds to the index of the products passed in productId.

This is part of the order definition and must be an integer; float values are not accepted. Multiple entries are separated by the pipe "|" character.

Example: q=2|1

searchTerm Required on search_page

The search term typed in by the shopper. You can also use the productId parameter to provide product IDs of the products in the search results.

Example: searchTerm=adriana lima

o Required on purchase_complete_page

Order ID. Part of the order definition.

Example: o=902312

currency Optional. Used on purchase_complete_page if currency is decoupled from regions

The ISO currency code representing the currency for each transaction or product request.

Example: currency= USD

Note: If not specified, this defaults to US currency (USD).

fpb Required on brand_page

The brand featured on the page. Used to set the seed for brand-seeded strategies, such as Brand Top Sellers.

Example: fpb=Microsoft

chi Optional on item_page, add_to_cart_page

Supplies category hint IDs. Category hints can be added to any page type. Each category hint qualifies the page for merchandising rules that are associated to the category. Merchants can add multiple category hints to a single page. The value of the parameter should be one or more category id, separated by the pipe “|” character.

Example with 2 category hints: chi=1913000|1903094

Response Configuration (Output Format)

Parameters that control how recommendations are returned, including which fields, attributes, or related data (e.g., categories, product metadata) are included in the response.

Parameter Name Required or Optional Description
attributeList Optional

This parameter limits the product attribute information included in the result to the specified list of attributes.

attributeList takes comma separated list of attribute names that should be shown in the response.

If the parameter is empty or wild card character '*', it will display all the product attributes in the response.

Example:

If "attributeList = gender,color", then it will return only gender and color attributes in the product attribute information."attributeList=*" Returns all product attributes."attributeList=" Returns all product attributes.

Note: If returnMinimalRecItemData option is set to true in the request which naturally returns a minimum set of information, and attributeList option is also specified, the response also includes the attributes specified in the parameter.

categoryData Optional

Omits category data (categoryIds and categories) when set to false. The default is true.

Example: categoryData=false

Note: excludeAncestor=false can be used to include the ancestor data.

ctp Optional

Click-through parameter. Used to add parameters to the click-through URL.

See Click-through Parameters for more information.

Example: ctp=|0:origin=CJ|1:campaign=rr

cts Optional

Click-through server. Changes a portion of the click-through URL when a shopper clicks on a recommendation. It specifies the destination server of the click (for example, www.buystuff.com vs. m.buystuff.com). This parameter is typically used during development to keep users within the same environment when clicking on a recommendation.

Example: cts=http://test.buystuff.com

Note: If the cts parameter is provided in the API request, it overrides the click-through server site configuration setting, and/or cts in the product URL delivered in the feed.

excludeAncestor Optional

True/False. When set to false, the response will include the ancestor data in the ancestorCategories array in the "categories" object.

Note: This parameter is meant to be used with categoryData parameter.

Example: excludeAncestor=false

Example JSON Response:

Copy
"categories": [
  {
    "hasChildren": false,
    "name": "Solder",
    "childCategories": [],
    "ancestorCategories": [
      {
        "hasChildren": true,
        "name": "Metals",
        "childCategories": [],
        "ancestorCategories": [],
        "id": "4",
        "isActive": false
      }
    ],
    "id": "1572",
    "isActive": false
  }
],
excludeHtml Optional

True/false. If true, it omits the HTML returned in the Algonomy server response. If false, the response includes the HTML for the placement which is set in the layout of the html field. The default is false.

Example: excludeHtml=true

excludeItemAttributes Optional

True/false. If true, it removes item attributes from the recommended products data. The default is false.

Example: excludeItemAttributes=true

excludeRecItems Optional

True/false. If true, it completely removes the recommended items structure. This is useful when HTML is sufficient for the response. The default is false.

Example: excludeRecItems=true

includeMVTData Optional

True/false. The default is false. If true, it includes details about any multivariate test (MVT) that is running.

Example: includeMVTData=true

Example JSON Response:

Copy
"mvt":
[
{ "testId":12953, "control":false, "treatmentId":15707, "treatmentName":"T2 - recs OFF” }
], 
includeMVTDetailedData Optional

True/false. The default is false. If true, it includes details about any multivariate test (MVT) that is running. The “eligible” string parameter will define that if the user is eligible for an MVT test or not.

Example: includeMVTDetailedData=true

Example JSON Response:

Copy
"mvtDetailed":
[
{ "eligible":true, "testId":12953, "control":false, "treatmentId":15707, "treatmentName":"T2 - recs OFF” }
]

When set to true, for Placement Type of Tests, the response will include a new section "mvtTreatments” providing MVT details that a placement is associated with.

Example JSON Response:

Copy
"placements":[
{
"mvtTreatments": [
{
"testType": "Placement”,
"testId": 55564,
"control": true,
"treatmentId": 60129,
"treatmentName": "swap_each_other"
}
]

Note: Only the treatments a placement is participating will be provided as part of the response. If the Placement test includes multiple placements, then all the placements will include the “mvtTreatment” as part of the response. If multiple Placement tests are happening for the same placement, then multiple treatments will be part of the response.

includeSkuData Optional

True/False, the default value is false. If true, any available sku data provided in the SKU Feed will be provided for the returned products.

Example: includeSkuData=true

Example JSON Response:

Copy
"skuData": [{
  "color": "White",
  "size": "12",
  "image_url": "http://demandware.edgesuite.net/9400.jpg",
  "sku_id": "9400"
}, {
  "color": "White",
  "size": "13",
  "image_url": "http://demandware.edgesuite.net/9401.jpg",
  "sku_id": "9401"
}]
includeStrategyData Optional

True/false. Default is false. If true, each placement in the response will include the strategy name.

Example: includeStrategyData=true

returnMinimalRecItemData Optional This will limit the recommendedProducts json to 4 attributes: id, productURL, clickURL, clickTrackingURL

Filtering & Constraints

Parameters used to limit or refine the recommendation results dynamically, including category, brand, attribute, or price restrictions.

Parameter Name Required or Optional Description
bi Optional

A list of product IDs that should not be recommended in this response. Use the pipe "|" character to separate product IDs.

Example: bi=93874|04495|043945

filbr Optional

Filter by brand name. The default excludes products of the specified brand from being recommended. See includeBrandFilteredProducts to change the default function. Filter multiple brand names by using the pipe "|" character between names.

Example: filbr=Microsoft|Logitech|Apple

filcat Optional

Specify the category to filter.

filcat=<categoryId>

To filter based on a specified category, the following should be specified:

"filcat=<categoryId>&filcatinc=true>"

Multiple category ids can be passed with pipe de-limited string. Each category in a string is OR'd

filcatinc Optional

Filter along category (requires specification of category with 'filcat')

filcatinc=true: filters results to only show products from the specified category

filcatinc=false: filters out results from the specified category

filterAtr Optional

Filter types and values selected by the shopper. Place quotation marks around all attributes, separate the types by using the pipe "|" character, and separate the values by using a semicolon. You must include quotation marks around all attributes.

Example: filterAtr=color:"Red"|size:"M";"L"

Note: filterAtr is for custom attributes only, use filbr and includeBrandFilteredProducts to filter by brands. This is for Search and Browse only, and it needs configuration by Algonomy first.

includeBrandFilteredProducts Optional

True/false. Changes the function of filbr from exclude to include. If not specified, the default is false, which will exclude the specified brand. If true, the brand filter excludes all products except the specified brand.

Example: includeBrandFilteredProducts=true

includePriceFilteredProducts Required for minPriceFilterand maxPriceFilter parameters

True/false. Changes the function of minPriceFilter and maxPriceFilter from exclude to include. If not specified, the default is false, and it excludes product prices that match the specified range. If true, the filter excludes all products outside of the price range.

Example: includePriceFilteredProducts=true

maxPriceFilter Optional

The maximum value of the price range filter. This filter matches the sale price of a product, or the list price if no sale price is provided. The value is in cents.

Note: This parameter will not work correctly unless includePriceFilteredProducts is also used.

Example: maxPriceFilter=10099 (this means $100.99)

minPriceFilter Optional

The minimum value of the price range filter. This filter matches the sale price of a product, or the list price if no sale price is provided. The value is in cents.

Note: This parameter will not work correctly unless includePriceFilteredProducts is also used.

Example: minPriceFilter=579 (this means $5.79)

rfm Optional

Refinements are used to assure recommended products have a specific attribute value or values. An individual refinement is specified as a colon separated name/value pair.

Example: rfm=name:value

To specify a refinement as the existence of the attribute, you can simply omit the value

Example: rfm=name

To specify multiple refinements, specify them as a delimited list using the pipe character ('|') as the delimiter.

Example: rfm=attributeName|attributeName1:value1|attributeName2:value2

For more information, refer to the Refinements section.

rfm_cond Optional

Refines recommendations based on multiple values using 'and' and 'or' logic operators, with the pipe character ('|') as the delimiter to separate the values.

Note: rfm_cond will only be applied if rfm is being used. If the 'rfm_cond' parameter is not present in the request, the default behavior (i.e 'and' logic) will be considered.

Example: rfm=attributeName:value1|attributeName2:value2&rfb=false&rfm_cond=or

rfb Optional

Refinement Fall-Back. Controls the cul-de-sac fallback behavior of refinements.

Example: rfb=false

Default value is true, meaning that refinement values that would reduce recommendations below the placement's minimum threshold will be discarded. For more information, refer to the Refinements section.

Audience Targeting

Parameters that influence which recommendations are shown to specific users or segments based on targeting rules or audience logic. Custom segments can be built targeting these parameters in Segment Builder.

Parameter Name Required or Optional Description
cv Optional

Cart value. Used for targeted campaigns involving cart value. It's expressed in cents; for example, $10 is represented as 1000.

Example: cv=9550 (this would equal to 95.50)

ipor Optional

Shopper IP address. Only use if the API request is not coming from the shopper’s device (for example, server-side integration).

Example: ipor=255.255.255.255

pref Optional

Referring page’s URL, may exist on every page. Shopper’s referrer prior to viewing the page. Used for reporting and merchandising. This is highly recommended.

Example: pref=http://www.google.com

sgs Optional

Supply user segments. Used for segment-targeted campaigns. List each segment using the format segment_number:segment_name, and then use the pipe "|" character to separate segments. You must pass both the segment ID and a segment name for each segment.

Example: sgs=101:NewUser|202:Male

userAttribute Optional

Custom keys and values that describe the current shopper. Separate information using a semicolon and the pipe "|" character.

Example: userAttribute=eye_color:blue;green|hair_color:brown

userAttributeReplace Optional

Usage is same as userAttribute, except that the attributes sent along with userAttributeReplace will replace all previously sent values for that attribute.

Example: userAttributeReplace=eye_color:black

In the above example all previous values of eye_color will be removed and replaced with black.

If the same attribute is sent along in a single request in userAttribute as well as userAttributeReplace, then the value sent in userAttributeReplace will take precedence.

This attribute also supports Delete update against attribute values.

Example: userAttribute=eye_color:|hair_color:

Optional & Advanced Parameters

Additional parameters that modify behavior or extend functionality but are not required for standard integrations.

Parameter Name Required or Optional Description
flv Optional

Flash version of the browser. It's only used if content displayed is flash.

Example: flv=20.0.0.306

jcb Required for jsonp

Name of the JavaScript function that JSON data is passed to. Must be specified if jsonp is set to true.

Example: jcb=processData

jsonp Optional

Boolean flag. The only valid value is true. If set to true, the jcb parameter must also be provided.

Example: jsonp=true

strategySet Optional

A prioritized list of strategy sets that you want returned based on the campaign use case. Please see additional details under Strategy Families listing below. If this is not provided, our recommendation engine will run King of the Hill (KOTH) to provide best recommendations given the information provided.

Example: strategySet=SiteWideBestSellers or strategySet=ProductBoughtBought|ProductViewedViewed

mvt_ftr Optional Stands for 'MVT Force Treatment'. Entering a treatment id will force the response to be from the specified treatment.

Implementation & Onboarding Parameters

Parameters primarily used during initial setup, testing, or migration, and typically not required for long-term production use.

Parameter Name Required or Optional Description
fdm Optional

Force Display Mode. True/false. If true, the parameter will force display. For example, in listen mode, it will return products bypass logging.

Valid Values:

For true: "t", "on", "yes", "true", "1", "y"

For false: "f", "off", "no", "false", "0", "n"

udd Optional

Use Dummy Data. True/false. If true, it returns random products for testing.

Example: udd=t

Adding 'categoryRec' attribute in response

When a strategy is enabled to return categories, each product returned for that strategy will include an attribute categoryRec in the response. When categoryData is set to True for a strategy, each product returned for that strategy will include categoryRec in the response and returns the following category details for products in strategy:

  • name

  • id

  • linkURL

  • imageURL

The category information for the Category Link URL and Category Image URL can be provided in the feed. Alternatively the link URLs can be constructed using a URL pattern, which can be set in the Site Configurations.

Example Requests (Recommend)

Retrieve the Home Page placement with placement ID rr1 for user with ID 48454648:

Copy
GET /rrserver/api/rrPlatform/recsForPlacements?apiKey=showcaseparent&apiClientKey=776cdd80331919e7&userId=48454648&sessionId=827ccb0eea8a706c4c34a16891f84e7b&placements=home_page.rr1

Request the Item Page placement with the placement ID vertical_rail, using the seed product ID 24516217 for the user with ID 48454648.

Copy
GET /rrserver/api/rrPlatform/recsForPlacements?apiKey=showcaseparent&apiClientKey=776cdd80331919e7&userId=48454648&sessionId=827ccb0eea8a706c4c34a16891f84e7b&placements=item_page.vertical_rail&productId=24516217

Request an the Add to Cart Page placement with the ID demo_mobile, for the user with ID 48454648, passing 24516217 (the ID of the product added to the cart) in the atcid parameter.

Copy
GET /rrserver/api/rrPlatform/recsForPlacements?apiKey=showcaseparent&apiClientKey=776cdd80331919e7&userId=48454648&sessionId=827ccb0eea8a706c4c34a16891f84e7b&placements=add_to_cart_page.demo_mobile&atcid=24516217

IMPORTANT: If you are doing a server side implementation, make sure to add compression headers to you request. This will allow RR servers to compress the response, which will result in a smaller payload and a faster response time. Example:

Copy
Accept-Encoding: deflate, gzip

Example Response (Recommend)

Copy
{
  "rcs": "eF5j4cotK8lM4TMzsNA11DVkKU32MEkyBAJjM11jYzMzXRNTozRdA0sgYZxiammQaGJmZmaaDABuTQ0O",
  "placements": [
    {
      "htmlElementId": "home_page_0",
      "placementType": "home_page",
      "strategyMessage": "Shop Top Sellers",
      "html": "",
      "placement": "home_page.rr1",
      "recommendedProducts": [
        {
          "clickURL": "https://integration.algorecs.com/rrserver/apiclick?a=showcaseparent&cak=776cdd80331919e7&ct=http%3A%2F%2Flabs.richrelevance.com%2Fstorre%2Fcatalog%2Fproduct%2Fview%2Fsku%2F22127002&vg=4b121136-3366-452f-092f-3d590a46665c&stid=126&pti=9&pa=11339&pos=0&p=22127002&channelId=776cdd80331919e7&s=827ccb0eea8a706c4c34a16891f84e7b&u=12345&mvtId=-1&mvtTs=1529712166361",
          "regionPriceDescription": "",
          "salePriceRangeCents": [
            1,
            1
          ],
          "rating": 3.884,
          "numReviews": 0,
          "priceRangeCents": [
            1,
            1
          ],
          "categoryIds": [
            "Electronics",
            "Electronics.Computers",
            "Electronics.Computers.Tablet PCs"
          ],
          "clickTrackingURL": "https://integration.algorecs.com/rrserver/apiclick?a=showcaseparent&cak=776cdd80331919e7&vg=4b121136-3366-452f-092f-3d590a46665c&stid=126&pti=9&pa=11339&pos=0&p=22127002&channelId=776cdd80331919e7&s=827ccb0eea8a706c4c34a16891f84e7b&u=12345&mvtId=-1&mvtTs=1529712166361",
          "salePriceCents": 1,
          "regionalProductSku": "22127002",
          "imageURL": "http://labs.richrelevance.com/storre/media/catalog/product/n/e/nextbook-7quot-tablet-with-8gb-memory-with-google-mobile-services-73fbdb1640b18e99695aa87c7da712f5.jpg",
          "name": "\"Nextbook 7\\\" Tablet with 8GB Memory with Google Mobile Services\"",
          "genre": "default",
          "isRecommendable": true,
          "priceCents": 6900,
          "attributes": {
            "MktplcInd": [
              "W"
            ],
            "Clearance": [
              "N"
            ],
            "97CentShipping": [
              "N"
            ],
            "Rollback": [
              "N"
            ],
            "Online": [
              "Y"
            ],
            "ListPrice": [
              "79"
            ],
            "AddToCart": [
              "Y"
            ],
            "IsReducedPrice": [
              "N"
            ],
            "IsSubmap": [
              "N"
            ],
            "S2S": [
              "Y"
            ]
          },
          "id": "22127002",
          "categories": [
            {
              "hasChildren": false,
              "name": "Electronics",
              "childCategories": [],
              "ancestorCategories": [],
              "id": "Electronics",
              "isActive": false
            },
            {
              "hasChildren": false,
              "name": "Computers",
              "childCategories": [],
              "ancestorCategories": [],
              "id": "Electronics.Computers",
              "isActive": false
            },
            {
              "hasChildren": false,
              "name": "Tablet PCs",
              "childCategories": [],
              "ancestorCategories": [],
              "id": "Electronics.Computers.Tablet PCs",
              "isActive": false
            }
          ],
           "categoryRec": {
            "name": ,
            "linkURL",
            "imageURL",
            "id":
        },
          "productURL": "http://labs.richrelevance.com/storre/catalog/product/view/sku/22127002",
          "brand": "Nextbook"
        }
      ]
    }
  ],
  "viewGuid": "4b121136-3366-452f-092f-3d590a46665c",
  "status": "ok"
}

clickURL and clickTrackingUrl Parameters

The table below describes the key parameters included in clickURL and clickTrackingUrl, along with their purpose and usage.

Name

Description

a This corresponds to the api key. Example: a=:showcaseparent.
cak API client key. Example: cak=776cdd80331919e7.
ct

This corresponds to the link URL for the recommended product. This is defined by the customer in the catalog feed or Streaming Catalog API. This parameter is only for clickUrl.

Example:

ct=http%3A%2F%2Flabs.richrelevance.com%2Fstorre%2Fcatalog%2Fproduct%2Fview%2Fsku%2F22127002.

vg

View guid - used for analytics. Example:

vg=4b121136-3366-452f-092f-3d590a46665c.

stid

Strategy ID (which recommendation strategy generated the result). Example: stid=126.

pti Page Type ID (corresponds to home_page or item_page, etc.) Example: pti=9.
pa Placement Area ID (internal placement/widget area reference). Example: pa=11339.
pos Position of the item within the recommendation list (0 = first, etc.). Example:: pos=0.
p Product ID of the recommended item. Example: p=22127002.
channelId Identical to cak. Example: channelId=776cdd80331919e.
s This corresponds to what the client sent in the sessionId parameter in the request. Example: s=827ccb0eea8a706c4c34a16891f84e7b.
u This corresponds to what the client sent in the request and to the userId parameter. Example: u=12345.
mvtId Multivariate Test ID (-1 = not in test). Example: mvtId=-1.
mvtTs Multivariate Test Timestamp (epoch when MVT assigned). Example: mvtTs=1529712166361.

Tracking Events

This endpoint will automatically log a page view event when called. It will also automatically log a placement impression for each of the placements returned. For example, if you request three placements but only one is returned, this endpoint will log a placement impression for this returned placement only.

When personalization placements are returned, recsForPlacements will expose both the product URL and click event trackers. When the user clicks on a recommended product, you are required to call a click event tracker for that product before redirecting the user to the product detail page. This is to ensure Algonomy can track the click along with the views, so that our products can accurately capture CTR data. This API will expose the following URLs:

  • productURL is the direct URL to the Product Detail Page. Use this URL to link to the product page, likely as the href attribute of an <a> tag.

  • clickTrackingURL tracks a product click without redirecting the user to the Product Detail Page. For SEO purposes, you can use this URL together with productURLand trigger a request to clickTrackingURL via a click event listener.

  • clickURL tracks a product click and redirects the user to the Product Detail Page via an HTTP 301 redirect.

  • amrid tracks the click to the Advanced Merchandising rule that returned the product recommendation. 

To successfully track clicks use one of the following options:

  1. Use clickURL which automatically tracks a product click and redirects the user to the Product Detail Page, or

  2. Use productURL as the final URL, and trigger a request to clickTrackingURL via an event listener. This is the suggested approach when SEO optimization is involved.

Your code should include logic like the following to render personalized product recommendations:

Copy
$('#personalization').on('click', 'a', function() {
  var targetURL = $(this).data('clickTrackingURL');
  var img = new Image();
  img.src = targetURL;
});

var recsForPlacementsURL = 'https://recs.algorecs.com/rrserver/api/rrPlatform/recsForPlacements?apiKey=a6x5029gd6941a22&apiClientKey=x3f023fd649003&placements=home_page.recommend&sessionId=27083322340392734752015'
$.getJSON(recsForPlacementsUrl, function(r) {
  if (!(r.placements && $.isArray(r.placements))) {
    return false;
  }
  
  var placementElement = $('#personalization'); 
  var products = r.placements[0].recommendedProducts;
  for (var i in products) {
    var product = $('<a>')
      .attr('href', products[i].productURL)
      .data('clickTrackingURL', products[i].clickTrackingURL)
      .text(products[i].name)
      .appendTo(placementElement);
  }
}); 

This will create the following HTML structure, and will trigger a click event before redirecting the user to the Product Detail Page.

Copy
<!-- The href value is productURL from a recsForPlacements response -->
<div id="personalization">
  <a href="/product/1">Product 1</a>
  <a href="/product/2">Product 2</a>
  <a href="/product/3">Product 3</a>
  <a href="/product/4">Product 4</a>
  <a href="/product/5">Product 5</a>
</div>

Testing

To test integrating on click events, use a web proxy or your browser's Developer Tools to monitor network requests. You should see a request to something that looks like this: 

Copy
http://recs.algorecs.com/rrserver/apiclick?a=5c84741760900058&vg=c12ab4b2...s=1437007681319&pg=1653&p=36714988&ind=0

You should expect this request to have a status code of 200 and empty response body.

IMPORTANT: If you do not see this request the page is not logging. Make sure you log clicks to send click data to Algonomy. Failing to log clicks will have a detrimental effect on personalization performances.

To force Development mode, use 'devMode=true'.