Ecommerce Edit the file on GitHub
Ecommerce tracking allows you to measure the transactions and revenue generated from your e-shop.
You can track two types of ecommerce data:
- Order
- A completed order - transaction
- Item
- An item of a completed order - transaction
Table of Contents
Ecommerce
addOrder
The addOrder
command creates an Ecommerce order object.
Data Parameters
Name | Type | Required | Description |
---|---|---|---|
order_id |
String | Yes | The Order ID that was produced by your e-shop. It is used to uniquely identify the transaction. |
revenue |
String | Yes | The total revenue or grand total of the order. This value must include shipping and tax costs. Any additional payment cost should be excluded. |
shipping |
String | Yes | The total shipping cost of the order. Any additional payment cost should be excluded. |
tax |
String | Yes | The total tax of the order. |
paid_by |
String | No1 | The payment method type of the order. The recommended payment method types are described in the table below. |
paid_by_descr |
String | No1 | The description of payment method of the order that explains the payment method type (free text). |
1 Required for shops that have products in Technology categories
Note
Make sure not to include any cash on delivery (COD) costs in either
revenue
orshipping
.
Recommended Payment Method Types
Type | Description (Examples) |
---|---|
bank_transfer |
Bank transfer |
cash_on_delivery |
Cash on delivery |
card |
Credit/Debit card |
paypal |
PayPal |
pay_in_store |
Pay in Store |
cryptocurrency |
Bitcoin, Etherium, etc. |
Note
Analytics can also accept payment method types that are not defined above, but IT IS NOT recommended.
Example
<script>
skroutz_analytics('ecommerce', 'addOrder', {
order_id: '123456', // Order ID. Required.
revenue: '1315.25', // Grand Total. Includes Tax and Shipping. Does not include payment costs.
shipping: '5.45', // Total Shipping Cost. Does not include payment costs.
tax: '301.25', // Total Tax.
paid_by: 'example_paid_by', // Payment method type, e.g. bank_transfer.
paid_by_descr: 'Example paid_by_descr' // Payment method description, e.g. Bank transfer.
});
</script>
Note
The
paid_by
&paid_by_descr
fields are required for shops that have products in Technology categories.
addItem
The addItem
command adds a new Ecommerce item object.
Data Parameters
Name | Type | Required | Description |
---|---|---|---|
order_id |
String | Yes | The Order ID that was produced by your e-shop. This ID links items to their orders. |
product_id |
String | Yes | The Unique ID from your e-shop. |
name |
String | Yes | The name of the product from your e-shop. |
price |
String | Yes | The individual, unit, final price for each item. |
quantity |
String | Yes | The number of units purchased in the order. |
Note
Example
<script>
skroutz_analytics('ecommerce', 'addItem', {
order_id: '123456', // Order ID. Required.
product_id: '111222', // Product ID. Required.
name: 'Apple IPhone 6 Plus (16GB) Space Gray EU', // Product Name. Required.
price: '654.90', // Price per Unit. Required.
quantity: '2' // Quantity of Items. Required.
});
</script>