addPurchaseRows
The addPurchaseRows method is used to add products a customer has purchased.
You don't need to send an additional API call with the addCartRows method to empty the cart after a conversion.
The method data is an array of objects. Each row is an object with properties specific to the purchased product. Some object properties are required while others are optional.
The required properties are as follows:
- purchaseId
- productId
- quantity
- unitPrice
A product ID (PID) as well as the purchase ID each can have no more than 50 characters. The API call fails if any PID exceeds this limit.
The purchaseId property must be the same across all rows within addPurchaseRows. The value it contains must be unique across all purchases to track purchases on your site. If your site passes a purchase ID to Monetate more than once, it discards the newer duplicate purchase ID and doesn't include it in analytics.
These object properties are optional:
- sku
- currency
If you are using Personalized Search, the SKU is a required parameter.
If your site doesn't use US dollars (USD) for purchases, then you must include currency information in this method.
Don't send empty strings for optional property values. Only send properties that have a value.
This screenshot shows the Components tab of the Monetate Inspector browser plug-in. The Purchase ID row indicates that the addPurchaseRows method has passed the transaction number to Monetate along with the required PID, quantity, and unit price values as shown in the Cart Products rows.
This code example contains the method in use that results in the Monetate Inspector results shown in the previous screenshot.