Skip to content

E-commerce

eodia analytics follows the purchase journey through an event convention, aligned with GA4 names to ease a migration. These eight events are predeclared and are the only ones that accept a list of items, items.

EventWhen to send it
view_item_lista product list is displayed (category, results, selection)
view_itema product page is displayed
add_to_cartitems are added to the cart
remove_from_cartitems are removed from it
begin_checkoutthe checkout begins
add_payment_infothe payment method is entered
purchasethe order is placed
refundthe order is refunded, in full or in part
EodiaAnalytics.track('purchase', {
transaction_id: 'C-2026-10412',
value: 129.9,
currency: 'EUR',
tax: 21.65,
shipping: 4.9,
coupon: 'AUTOMNE',
items: [
{ id: 'KA2', name: 'Kerys Air 2', category: 'Audio', brand: 'Kerys', variant: 'noir', price: 125, quantity: 1 },
],
})
PropertyEventsRole
currencyallthe currency, ISO 4217 code (EUR)
valueallthe total value of the action, in the currency
transaction_idpurchase, refundthe unique identifier of the order
tax, shipping, couponpurchase, refundtaxes, shipping costs, discount code
item_listview_item_listthe name of the list
itemsallthe items, 50 at most

An item carries at least an id or a name, and, optionally: category, brand, variant, price, quantity, coupon, discount.

EodiaAnalytics.track('add_to_cart', {
currency: 'EUR',
value: 59,
items: [{ id: 'PL-ROUGE', name: 'Plaid Arvor', category: 'Maison', variant: 'rouge', price: 59, quantity: 1 }],
})

The analytics.purchases view keeps one row per transaction_id: a reloaded confirmation page, or an order sent by both the browser and the server, does not double the revenue. Amounts sent by the site’s server take precedence; received tells how many sends arrived, confirmed whether the server confirmed.

refund counts as negative, for the whole order or for some items (with items).

  • analytics.purchases: one row per order or refund (amount, currency, taxes, shipping, coupon, number of items, visit), and the channel through a join with sessions;
  • analytics.commerce_items: one row per item and per step: step, product, category, brand, variant, price, quantity, revenue (price × quantity);
  • analytics.attribution: each order attributed to the visits that preceded it, according to six models. See attribution.
-- This week's purchase funnel, step by step
SELECT step, count(DISTINCT session_id) AS visits
FROM analytics.commerce_items
WHERE day >= current_date - INTERVAL '7' DAY
GROUP BY step

No conversion: currency is a column. Dashboards filter or group on it. A site that sells in several currencies keeps its amounts as they are.

A goal (Metadata tab) can target an event, purchase for example, and take its value, value, or a fixed value. The analytics.conversions view carries this value.

The browser may never display the confirmation page: a three-step payment, a closed tab, a blocker. The most reliable order is sent from your server, once the payment is confirmed. See server-side collection.

eodia analytics is free software by Eodia.