Implementing product recommendations in Faststore
Learn how to implement product recommendations in FastStore stores.
This feature is in beta. If you're a VTEX client and want to use this feature in your business, contact VTEX Support.
The product recommendation feature in FastStore displays a curated selection of products based on custom recommendation strategies.

Before you begin
Install Intelligent Search
Make sure Intelligent Search is installed, enabled, and integrated with the catalog in your account. To do this, follow the instructions in these guides:
Receive approval for the product recommendations feature
Open a ticket with VTEX Support to request the use of the product recommendations feature for your FastStore account.
Instructions
Step 1 - Set up your account environment
After you receive the approval to use the product recommendations feature, the VTEX support team will prepare your account environment by:
- Creating a Synerise workspace for recommendations.
- Synchronizing your product catalog with the recommendation service.
- Setting up API keys for secure access.
- Generating a custom integration script for your store.
Step 2 - Implement the script in the FastStore project
To collect shopper product interaction events for training and delivering recommendations, implement the script provided by VTEX Support as a third-party script in your FastStore project. To do this, follow these instructions:
-
Add a new section that fetches products and tracks views and click events, similar to a carousel.
After creating this new section, you can add it to any part of the store, including Home, PDP, and PLP.
-
Add the script provided by VTEX Support as a third-party script in your FastStore project. To add the script, follow the instructions in the Adding third-party scripts guide.
-
Save the
_snrs_uuidin the user'sorderForm, so that when the order is placed, it is possible to attribute that sale to the user identified during navigation. When the ID is generated, it is necessary to save the user's ID in theorderFormduring navigation usingPUTto set multiple custom field values as shown below:_10fetch(`/api/checkout/pub/orderForm/$\{orderForm.id\}/customData/synerise`, {_10method: 'PUT',_10body: JSON.stringify({_10uuid: snrsUuidCookie,_10source: isMobile() ? 'WEB_MOBILE' : 'WEB_DESKTOP',_10}),_10}) -
Validate that the
_snrs_uuidwas saved in theorderFormby retrieving theorderFormusingGETGet current cart. ThecustomDatafield returned should contain the added information. -
Send the
POSTProduct View event following the API reference.
Step 3 - Train the models
Once the tracking script collects enough browser data, the VTEX team will train and configure the recommendation models for each strategy. The available strategies are:
| Name | Description |
|---|---|
| Most popular | Products with the highest number of views |
| Recommended for you | Custom recommendations based on user profile and behavior |
| Similar products | Products similar to a specific one |
| Cross-sell | Complementary products for a specific one that are commonly purchased together. |
| Best sellers | The store's best-selling products |
| Last seen | Products recently viewed by the user |
| Recent interactions | Products most likely to engage the user in the future |
| Visually similar products | Products visually similar to a specific one |
| Manual collection | Recommendations from a collection created manually |
After the models are trained, they will be available for API-based recommendation displays in your store.
Step 4 - Integrate product recommendations
Once models for each selected strategy are trained, you can integrate product recommendations into your store and display them during shopper interactions by following these steps:
- Managing user session
- Fetching products for the recommendation component
- Tracking event interactions.
Managing user session
Use the POST Start Session endpoint to create a unique user ID for recommendations. This endpoint:
- Generates a unique user ID (
recommendationsUserId) for the session. - Links it to the provided order form ID.
- Stores the ID in the
vtex-rec-user-idcookie for session continuity. - Initializes recommendation tracking and personalization.
Call this endpoint on the first page view of each visit, before displaying any recommendations, and only if the
_snrs_uuidis not already present. IforderFormIdis not provided in the request body, the API attempts to retrieve it from thecheckout.vtex.comcookie.
Request example:
_10curl --request post \_10 --url https://api.vtexcommercestable.com.br/api/recommend-bff/v2/users/start-session \_10 --header 'Accept: application/json' \_10 --header 'Content-Type: application/json' \_10 --header 'host: apiexamples.vtexcommercestable.com.br' \_10 --header 'x-forwarded-host: www.apixamples.com' \_10 --header 'x-vtex-rec-origin: apiexamples/storefront/vtex.recommendation-shelf@2.x' \_10 --data '{"orderFormId":"d761924de4254f6883a8ec2e9a28597d"}'
Response example:
_10{_10 "recommendationsUserId": "198e0f50-acf8-42f7-998a-5cd125464749"_10}
Persist the returned recommendationsUserId as _snrs_uuid and include it in all subsequent requests.
Fetching products for the recommendation component
Use the GET Fetch recommendations endpoint to fetch products for each shelf whenever a page contains a recommendation component (homepage, PDP, cart, PLP, etc.).
The campaign determines the type of recommendations returned, such as personalized recommendations, similar items, cross-sell, and others.
This endpoint retrieves a list of recommended products based on:
-
Campaign VRN (Virtual Resource Name) identifying the recommendation strategy. The VRN follows the pattern
vrn:recommendations:{store-name}:{campaignType}:{campaignId}. Contact VTEX Support to obtain thecampaignId.Available campaign types:
rec-top-items-v2: Best sellersrec-persona-v2: Personalized recommendationsrec-similar-v2: Similar itemsrec-cross-v2: Cross-sellrec-cart-v2: Cart-based recommendationsrec-last-v2: Last seenrec-interactions-v2: Recent interactionsrec-visual-v2: Visual similarityrec-search-v2: Search-based recommendationsrec-next-v2: Next interaction
-
User context (from
recommendationsUserId). -
Page context (product ID, cart items, etc.).
Request example:
_10curl --request get \_10 --url 'https://api.vtexcommercestable.com.br/api/recommend-bff/v2/recommendations?an=apiexamples&campaignVrn=vrn%3Arecommendations%3Aapiexamples%3Arec-top-items-v2%3A123e4567-e89b-12d3-a456-426614174000&userId=198e0f50-acf8-42f7-998a-5cd125464749&products=product-id-1%2Cproduct-id-2%2Cproduct-id-3&salesChannel=1&locale=en-US' \_10 --header 'Accept: application/json' \_10 --header 'x-vtex-rec-origin: apiexamples/storefront/vtex.recommendation-shelf@2.x'
Response example:
_13{_13 "products": [_13 "1234",_13 "5678",_13 "91011"_13 ],_13 "correlationId": "rec-123e4567-e89b-12d3-a456-426614174000",_13 "campaign": {_13 "id": "123e4567-e89b-12d3-a456-426614174000",_13 "title": "Most Popular Items",_13 "type": "TOP_ITEMS"_13 }_13}
Render the returned items as product cards on the shelf. After rendering, proceed to event tracking.
Tracking event interactions
To improve recommendation accuracy and measure effectiveness, you need to track how users interact with the recommended products. There are three types of events to track:
- Recommendation views: When recommendation shelves become visible to users.
- Recommendation clicks: When users click the recommended products.
- Product views: When users visit product detail pages.
For accurate tracking, ensure that:
- All events include the same
recommendationsUserId. - Events are properly debounced to prevent duplicates.
- View events are triggered only when shelves enter the viewport.
Recommendation views
Use the POST Recommendation view endpoint when a recommendation shelf becomes visible. This endpoint:
- Records when recommendations are shown to users.
- Provides data for click-through rate (CTR) analysis.
- Helps train and improve recommendation models.
- Should be called when shelves enter the viewport.
Request example:
_10curl --request post \_10 --url 'https://api.vtexcommercestable.com.br/api/recommend-bff/v2/events/recommendation-view?an=apiexamples' \_10 --header 'Content-Type: application/json' \_10 --data '{"userId":"user-id","correlationId":"correlation-id--from-recommendation-request","products":["product-id-1","product-id-2","product-id-3"]}'
Recommendation clicks
Use the POST Recommendation click endpoint when users interact with recommended products. This endpoint tracks user engagement with recommendations and should be called for each click on a product card.
Request example:
_10curl --request post \_10 --url 'https://api.vtexcommercestable.com.br/api/recommend-bff/v2/events/recommendation-click?an=apiexamples' \_10 --header 'Content-Type: application/json' \_10 --data '{"userId":"user-id","correlationId":"correlation-id--from-recommendation-request","product":"product-id"}'
Product views
Use the POST Product View endpoint when users view product details. This endpoint tracks all product detail page views.
VTEX automatically tracks product views once the Recommendations feature is set up in your store’s website, as instructed in Step 2. This event is only required for app implementations or other channels. Track product views for all sources to ensure comprehensive data collection for the recommendation models.
Request example:
_10curl --request post \_10 --url 'https://api.vtexcommercestable.com.br/api/recommend-bff/v2/events/product-view?an=apiexamples' \_10 --header 'Content-Type: application/json' \_10 --header 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' \_10 --header 'x-vtex-rec-origin: apiexamples/storefront/vtex.recommendation-shelf@2.x' \_10 --data '{"userId":"user-id","product":"product-id-1","source":"WEB_DESKTOP"}'