> For the complete documentation index, see [llms.txt](https://docs.fact-finder.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fact-finder.com/integration/recommendation-engine-integration/supplying-the-recommendation-engine-with-sales-data.md).

# Supplying the Recommendation-Engine with sales data

In addition to the product data already available through Search, the FactFinder Recommendation Engine also needs sales information.

There are two common ways to provide it. You can either send the data through the Tracking interface or provide it in a file submitted at regular intervals.

### Tracking

This is the recommended method because tracking also offers extra benefits, such as additional analytics. The Tracking interface is part of the standard FactFinder integration, so this usually does not add extra work.

You can find more detail about the Tracking interface in the integration documentation. To provide sales data for the Recommendation Engine, integrate tracking at least through the `buy` event.

The main drawback is that sales data is only available from the time tracking is integrated. If this is a new setup, expect a short learning period. To shorten that period, you can also provide historical sales data in an export file.

> Tracking data must first be prepared by Analytics before the Recommendation Engine can use it. The `WhatsHot` job collects that data periodically, usually once a day, from Analytics and stores it in the `APP_RESOURCES/analytics` directory. The Recommendation Engine import works only when data is available.

### Export file

The same principles that apply to exporting product data also apply when creating this export file. For more information on these principles, see: [Record structure for export/import](/docs/import/ff-search-integration-how-to-optimize-your-datafeed.md).

A CSV text file is the ideal format. The export must be a complete export. Incremental deliveries are not supported. If the data volume is large, limit the exported period to 6–12 months.

The file must contain the following information:

|                    |                                                                                                                                                                                                                                                         |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name               | Description                                                                                                                                                                                                                                             |
| Timestamp          | Date and time of purchase.                                                                                                                                                                                                                              |
| Product-ID         | ID or article number of the purchased product. This identifier must also be present in the product data provided to the FactFinder Search tool. In the product data, this must be the field with the field role `productNumber`.                        |
| Quantity           | Quantity of the product that has been purchased.                                                                                                                                                                                                        |
| Shopping Basket ID | The shopping basket ID is required to establish which products were purchased together. This ID must be unique per shopping cart. If it is missing or 0, the corresponding event is ignored.                                                            |
| User ID            | The user ID identifies the purchaser. If the user is logged in when making the purchase, the shop’s own user ID is used for this parameter. If your web shop supports purchases without logging in, this must be an ID that is unique to each purchase. |

> If variants exist in the product data and a `masterArticleNumber` is available, also pass the `masterId`. When a product variant is purchased, the engine then learns the relationship to the master product.

#### Example

```language-plaintext
Timestamp;ProductID;Amount;CartID;UserID
2009-03-26 00:08:10;16041987;1;3880;23
2009-03-26 00:08:10;4582657;1;3880;23
2009-03-26 00:08:10;8954245;1;3880;23
2009-03-26 00:28:25;5659536;2;3881;30
2009-03-26 00:08:10;4582657;1;3882;42
2009-03-26 00:28:25;4571231;1;3883;51
...
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fact-finder.com/integration/recommendation-engine-integration/supplying-the-recommendation-engine-with-sales-data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
