In order for Granify to accurately calculate analytics, it needs to have accurate order information. It is absolutely critical that order tracking is implemented before anything else.
The Granify.trackOrder function is used to notify Granify about completed purchases.
Placement
Granify.trackOrder must be called on the page displayed after an order has been finalized and paid (ex. the receipt page). This code needs to be run as soon as possible on the page, and the data passed needs to match your analytics.
Usage
For usage information, see the Granify.trackOrder documentation.
Example
Granify('trackOrder', {
currency: 'USD',
order_number: '1234567890',
total_line_items_price: 150.00, // (sum of items price)
subtotal_price: 140.00, // (sum of items price - sum of discount_codes)
total_tax: 7.00,
total_shipping: 13.00,
total_price: 160.00, // (sum of items price - sum of discount_codes + total_tax + total_shipping)
financial_status: 'paid',
line_items: [{
sku: '123456',
product_id: '123',
quantity: 1,
price: 100.00,
regular_price: 100.00,
title: 'My Product Title'
}, {
sku: '234567',
product_id: '234',
quantity: 1,
price: 50.00,
regular_price: 100.00,
title: 'Another Product Title'
}],
discount_codes: [{
code: 'save',
amount: 10.00
}]
});
Next: Analytics Integration