The addPurchaseRows
method is used to add products a customer has purchased.
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
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.
Optional cart row objects include SKU and currency. If your site doesn't use US dollars for purchases, you must include currency information in this method.
Monetate Inspector Example
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.
Code Samples
// addPurchaseRows Method window.monetateQ.push([ "addPurchaseRows", [{ "purchaseId": "idString", "productId": "pidString", "quantity": "quantityString", "unitPrice": "priceString", "sku": "pidString", "currency": "currencyString" }] ]);
// addPurchaseRows Example window.monetateQ = window.monetateQ || []; window.monetateQ.push([ "addPurchaseRows", [{ "purchaseId": "73893797", "productId": "a123", "quantity": "1", "unitPrice": "99.99", "currency": "EUR" }, { "purchaseId": "73893797", "productId": "b345", "quantity": "3", "unitPrice": "29.99", "currency": "EUR" }] ]); window.monetateQ.push([ "trackData" ]);