Permalink
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (45 sloc) 2.25 KB
---
parent: analytics
title: ecommerce
---
# Ecommerce <%= edit_link %>
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
<%= partial 'partials/toc' %>
## 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.
> ##### Note
> Make sure **not** to include any spot cash costs in either `revenue` or `shipping`.
##### Example
<%= render_code_from_file 'analytics/order_beacon' %>
### 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](/feedspec/#unique-id) from your e-shop.
`name` | String | Yes | The [name](/feedspec/#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
> 1. As the `Product ID` you **must** provide the same [Unique ID](/feedspec/#unique-id) that is
> submitted as part of the XML feedspec.
> 2. The `name` of the product **must** match the [Name](/feedspec/#name) that is
> submitted as part of the XML feedspec.
> 3. Make sure your `Order ID` in your `addItem` command matches the one submitted by `addOrder`.
##### Example
<%= render_code_from_file 'analytics/item_beacon' %>