Recombee AddPurchase
Records when a user purchases an item. Purchases are strong signals for recommendation algorithms and help improve recommendation accuracy. This operation is essential for tracking successful transactions
Overview
This node records purchase events where a user buys an item. It sends these purchase records to a recommendation engine service, which uses them as strong signals to improve the accuracy of its recommendations. This operation is essential for tracking successful transactions and feeding real-time purchase data into recommendation algorithms.
Common scenarios include:
- E-commerce platforms tracking user purchases to personalize product recommendations.
- Content providers recording content purchases or subscriptions to tailor future suggestions.
- Any system that wants to enhance recommendation quality by incorporating actual purchase behavior.
Practical example:
- When a user completes a checkout on an online store, this node can be triggered to log the purchase event with details such as user ID, item ID, quantity, and timestamp. The recommendation engine then updates its model to better suggest relevant products to that user and others.
Properties
| Name | Meaning |
|---|---|
| User ID | The ID of the user who made the purchase. |
| Item ID | The ID of the item that was purchased. |
| Amount | Optional amount of items purchased. Default is 1. |
| Cascade Create | Whether to create the item if it does not exist in the recommendation database. |
| Timestamp | Optional timestamp of when the purchase occurred. If not provided, the current time will be used. |
| Max Retries | Number of times to retry failed batch requests. Useful for handling temporary network issues or rate limits. |
| Recommendation ID | Optional recommendation ID. If provided, the purchase will be associated with the specified recommendation. |
Output
The node outputs an array of JSON objects, each representing the result of attempting to record a purchase event. Each output object contains:
success: Boolean indicating whether the purchase was recorded successfully.- Original input properties (
userId,itemId,amount,timestamp, etc.) for reference. data: Contains response data from the recommendation API if the request succeeded.error: Contains error information if the request failed.
If multiple purchase events are processed in batch, the output includes one entry per event, preserving their order and pairing.
The node does not output binary data.
Dependencies
- Requires an API key credential for authenticating with the external recommendation engine service.
- Needs configuration of the recommendation database ID, private token, and region.
- Uses an external library client for interacting with the recommendation API.
- The node respects a configurable timeout setting for API requests.
- Supports retrying failed batch requests up to a configured maximum number of retries.
Troubleshooting
- Network or Rate Limit Errors: The node retries batch requests up to the configured max retries. If failures persist, check network connectivity and API rate limits.
- Invalid Credentials: Ensure the API key and other credentials are correctly set up; otherwise, authentication errors will occur.
- Missing Required Fields: The node requires
User IDandItem ID. Omitting these will cause errors. - Cascade Create Disabled: If
Cascade Createis false and the item does not exist in the recommendation database, the request may fail. - Timestamp Format Issues: The timestamp must be valid or omitted to use the current time. Invalid timestamps may cause errors.
- Continue On Fail Behavior: If enabled, the node continues processing remaining items even if some fail, reporting errors individually.