Use offline purchases in a Product Recommendation model
Use offline purchases in a Product Recommendation model
By default, a Product Recommendation model trains its purchase-based strategies on online purchases only. This article explains how you can add ingested offline purchases to your model’s training dataset.
How offline purchases affect Product Recommendation models
This section explains which offline purchases are eligible, which data they contribute, and how they affect the model’s training dataset and recommendations.
Which offline purchases are included
Uploaded offline purchase data is split into individual products, that is, items from the payload’s products array.
Each product inherits its transaction-level property values, such as the transaction timestamp.
It also inherits the trackingId of the data collection that the transaction was uploaded to.
An offline purchase product is added to the training dataset only when all the following conditions are met:
-
Its
productIdmatches a product ID in the catalog used by the model. The match is case-insensitive. -
Its
quantityis greater than0. -
Its
timestampvalue falls within the model’s training period. -
Its
trackingIdmatches a tracking ID configured for the model.
Offline purchase products that don’t meet these conditions are ignored without generating an error.
How offline purchases affect the training dataset
Offline purchases count toward the model’s minimum number of events. This can help a model with too few online purchases to build. Turning off offline purchases can cause the same model to fall below that minimum.
Online and offline purchases share a limit of 100 million purchase events. A large volume of offline purchases can push older online purchases out of the training data.
Effects and limitations of offline purchases
Offline purchases affect purchase-based model strategies, including Most purchased and Purchased together - Cart.
Strategies based on product views aren’t affected.
Each offline transaction is treated as an anonymous session. Offline purchases aren’t linked to a user and don’t contribute to user-level personalization.
Offline purchase events aren’t associated with a physical store or other location identifier. The model can use offline purchases to learn overall purchase behavior, but can’t use them to target recommendations to a specific store or location.
Although offline-purchase events include price and revenue values, the Product Recommendation model doesn’t use these values as training signals.
Recommendation coverage depends on your product assortment. If most products sell infrequently, some strategies may still return few recommendations or fall back to popular products.
Prerequisites
Before adding offline purchases to your Product Recommendation model training dataset, ensure that the following prerequisites are met:
-
A data collection with
dataCollectionTypeset toOFFLINE_PURCHASESthat contains all the offline purchases you want the model to use. Add missing purchases and remove test and internal transactions if necessary. -
A data collection that uses a
trackingIdthat matches one of the tracking IDs configured in your Product Recommendation model. -
Offline purchase `productId`s that match the product IDs in the catalog used by your model.
Add offline purchases to the model training dataset
-
(Optional) On the Models (platform-ca | platform-eu | platform-au) page, click the Product Recommendation model you want to add offline purchases to, and then click Duplicate in the More menu. This creates a duplicate of the original model to be used only as a baseline model for comparison purposes. The new model’s name appends
_copyto the original model’s name.Notes-
The new model isn’t associated with a query pipeline, so it isn’t used to serve recommendations.
-
The new model immediately starts building.
-
Having two models, one that uses only online purchases and another that includes online and offline purchases simplifies validation of the updated model.
-
-
On the Models (platform-ca | platform-eu | platform-au) page, click the Product Recommendation model you want to update, and then click Edit JSON in the More menu.
-
In the Edit a Model JSON Configuration panel, add
useOfflinePurchasesas a property of theextraConfigobject and set its value totrue. Keep all other model configuration values unchanged. For example:{ ... "extraConfig": { "catalogId": "1234a56b-7c89-1234-d56e-f78g9h12i1l3", "useOfflinePurchases": true, "trackingIds": [ "barca_ca" ], ... } } -
Click Save. This triggers a build of your model.
Check that the model uses offline purchases
A model build doesn’t report how many offline purchases it used. A successful build shown in the Activity Browser (platform-ca | platform-eu | platform-au) doesn’t confirm that offline purchases were included.
To assess the effect of adding offline purchases, compare the updated model with an otherwise identical model trained using online purchases only over the same training period.
-
Compare the Purchase events counts in the Filtered dataset summary sections of the updated and baseline model configurations. If eligible offline purchases are included, the updated model’s count can be higher, subject to the filtering criteria applied to the dataset and the shared event limit.
-
For additional validation, compare the recommendations generated by the updated and baseline models.
If the updated model doesn’t appear to be using the offline purchases data, check that your purchases meet all eligibility conditions and review your data collection ingestion logs for warnings and errors.
|
|
Note
To train the model using only online purchases again, set |
What’s next?
-
If the updated model isn’t already associated with the query pipeline used by your recommendation interface, associate the model with a query pipeline.
-
Review the available Product Recommendation strategies to identify the strategies that can use offline purchases.
-
If you receive offline purchases regularly, consider automating their ingestion. See Ingest data into a data collection for the API requests used to add, update, and delete data collection items.