Show Menu

Plan and implement Recommendations

What you need to know before creating a Recommendations activity.

Plan and Implement Recommendations

What you need to know before creating a Recommendations activity.
Recommendations requires that you set up the following hierarchy of information:
JavaScript library
Each page requires a reference to at.js version 0.9.1 (or later) or mbox.js version 55 (or later). This implementation step is required on all pages where a Target activity will be used, and can include keys such as a product or category ID.
For information about at.js, see at.js Implementation .
For more information about mbox.js, see Mbox.js Implementation .
The key determines the type of product or content that displays in your recommendations. For example, the key might be a product category. See Base the Recommendation on a Recommendation Key .
Attributes provide more specific information about the products you want to display. For example, you might want to show products within a certain price range, or items that meet an inventory threshold. Attributes can be provided in the mbox or through a feed .
Exclusions determine which specific items do not appear in your recommendations.
Purchase details
Purchase details provide information about purchased items and the order when the purchase has been completed.

Base Implementation

The base implementation requires that you pass parameters to your page that determine which products or services appear in your recommendations.
Before you begin setting up a Recommendations activity, you should understand how product data is provided to Recommendations, and decide which method works best for your needs.
There are two methods to provide information about products and services to Recommendations:
Pass parameters directly to the page
This method works well for items that change frequently. However, because it requires that changes be made directly to the page, in many organizations, this method requires the involvement of IT and the people who implement the pages.
Pass parameters through a Google or CSV feed
This method works well for collections that do not change frequently. It is usually not necessary to change your implementation or other page code to provide product information through a feed. However, the product list remains static, so quick changes are more difficult. For more information, see Feeds .
These methods can be used separately or together, as in the following examples.

Example One: Combine Page and Feeds

One common Recommendations implementation option uses both page parameters and feeds.
This method might be preferred by a retailer who has a relatively set product catalog, but who might want to emphasize specific seasonal items or items that are on sale. Most customers might provide their information primarily through the feed, with only occasional adjustments on the page.
Use a feed to provide information that does not change frequently. Whether using a CSV file or Google feed, use the following parameters:
  • Required parameters
  • Helpful parameters
    • entity.categoryId
    • entity.brand
    • entity.pageUrl
    • entity.thumbnailUrl
    • entity.message
    • All custom attributes
Once the feed is set up and passed to Recommendations, pass parameters on the page for attributes that change frequently, i.e. more often than daily.
  • Required parameters
    • entity.categoryId
  • Helpful parameters
    • entity.inventory
    • entity.value
Priority is given to whichever set of data runs most recently. If you pass the feed first and then update the page parameters, changes that are made in the page parameters will be shown, replacing item information passed in the feed.

Example Two: Pass All Parameters on the Product (or Content) Details Page

If you pass all parameters on the page, you can quickly make updates by updating the page. In some organizations, this requires the involvement of IT or your Web Design team.
This example might be especially useful for a media company, with content that constantly changes.
  • Required parameters
    • entity.categoryId
    • All other attributes

Sample Code

For example, you can use the following code in the header section of your product or content pages:
function targetPageParams() {
 return {
    "entity": {
       "id": "32323",
       "categoryId": "My Category",
       "value": 105.56,
       "inventory": 329

For more examples of the code you might use on different types of pages, see Implementation According to Page Type .

Implementation According to Page Type

Page type will influence your Recommendations implementation.
For example, the types of recommendations you want to present may be different on a product page than on a category page or your home page. For each page, you can run specific functions prior to the mbox call to display the appropriate recommendations.
For information about the attributes in the examples, see Entity Attributes .
Valid JSON formatting is required.
The targetPageParams function shown below is especially helpful if you are using a tag management solution to implement your pages. Adobe Launch or Adobe Dynamic Tag Manager (DTM) places the at.js/mbox.js reference and the targetPageParams function on your page and allows you to configure the values. You should either place that function before your at.js/mbox.js call, or put it in the Extra JavaScript section of your at.js/mbox.js.

All Pages

All pages that contain recommendations require either an at.js or mbox.js reference on the page. Add one of the following references to all pages with recommendations:
<script src="../at.js /></script>

<script src="../mbox.js /></script>

This implementation requires:
  • at.js version 0.9.2 (or later) or mbox.js version 55 (or later)
  • mbox.js must include the reference to target.js ( at.js does not require a reference to target.js)
For more information about implementing at.js, see How to Deploy at.js .
For more information about implementing mbox.js, see Mbox.js Implementation .
For more information about the differences between the two Target Javascript libraries, see Benefits of at.js .

Category Page

On a category page, you probably want to restrict your recommendations to products or content within that category. To set up a category page, you set up the keys used by the page. For more information about keys, see Base the Recommendation on a Recommendation Key .
function targetPageParams() { 
   return { 
      "entity": { 
         "categoryId": "My Category" 

Product Page

On a product page, you might want to recommend specific items, or items with a particular price or inventory level. For a product page, you might need to set up frequently changing attributes (such as value and inventory), in addition to the keys required for a category page.
function targetPageParams() { 
   return { 
      "entity": { 
         "id": "32323", 
         "categoryId": "My Category", 
         "value": 105.56, 
         "inventory": 329 

Cart Page

On a cart page, you likely want to exclude some items from your recommendations, such as the items that are already in the cart.
<script type="text/javascript">
function targetPageParams() {
   return {
      "excludedIds": [352, 223, 23432, 432, 553]

Thank You Page

On the Thank You page, you might want to show the order total, and the order ID, and show the products that were purchased, without recommending additional items. You can implement a second mbox to capture the order information.


Use settings to manage your Recommendations implementation.
To access the Recommendations Settings options, open Target in the Adobe Experience Cloud, then click Recommendations > Settings .
The following options are available:
Custom Global Mbox
(Optional) Specify the custom global mbox used to serve Target activities. By default, the global mbox used by Target is used for Recommendations.
Note: This option is set on the Target Administration page. Open Target, then click Administration > Visual Experience Composer.
Industry Vertical
The industry vertical is used to help categorize your recommendations criteria. This helps members of your team find criteria that make sense for a particular page, such as criteria that are best for the shopping cart page or for a media page.
Filter Incompatible Criteria
Enable this option to show only those criteria where the selected page passes the required data. Not every criteria will run correctly on every page. The page or mbox needs to pass in or entity.categoryId for the current item/current category recommendations to be compatible. In general, it is best to show only compatible criteria. However, if you want incompatible criteria to be available for the activity, uncheck this option.
It is recommended that you disable this option if using a tag management solution.
For more information about this option, see Recommendations FAQ .
Default Host Group
Select your default host group.
The host group can be used to separate the available items in your catalog for different uses. For example, you can use host groups for Development and Production environments, different brands, or different geographies. By default, preview results in Catalog Search, Collections, and Exclusions are based on the default host group. (You can also select a different host group to preview results, by using the Environment filter.) By default, newly added items are available in all host groups unless an environment ID is specified when creating or updating the item. Delivered recommendations depend on the host group specified in the request.
If you don't see your products, make sure that you are using the correct host group. For example, if you set up your recommendation to use a staging environment and you set your host group to Staging, you might need to re-create your collections in the staging environment for the products to show. To see which products are available in each environment, use Catalog Search with each environment. You can also preview the contents of Recommendations collections and exclusions for a selected environment (host group).
Note: After changing the selected environment, you must click Search to update the returned results.
The Environment filter is available from the following places in the Target UI:
  • Catalog Search (Recommendations > Catalog Search)
  • Create Collection dialog box (Recommendations > Collections > Create New)
  • Update Collection dialog box (Recommendations > Collections > Edit)
  • Create Exclusion dialog box (Recommendations > Exclusions > Create New)
  • Update Exclusion dialog box (Recommendations > Exclusions > Edit)
For more information, see Hosts .
Thumbnail Base URL
Setting a base URL for your product catalog makes it possible to use relative URLs when specifying thumbnails of your products when passing in your thumbnail URL.
For example:
sets a URL relative to the thumbnail base URL.
Recommendations API Token
Use this token in Recommendations API calls, such as the Download API.