Online stores and payments
Revenue by source, in any currency, and the path to purchase
You sell things online: a store, digital products, courses, bookings. You want revenue next to the visitors who brought it, by channel and campaign, in every currency you sell in, and the steps where shoppers give up.
Who it's for
Online stores, sellers of digital products and courses, and any site that takes payments.
What you get
| Feature | What it answers | Guide |
|---|---|---|
| Revenue on events | Money per event, the average order value, revenue over time | Revenue |
| Payment providers | Revenue straight from Stripe, Razorpay or Dodo Payments, tied to the visit | Payment providers |
| Several currencies | Every sale converted to your project's currency at the day's rate | Several currencies |
| Revenue by source | Which channel, campaign or site brought the buyers | Revenue |
| Funnels | Where shoppers drop off between product and payment | Funnels |
| Goals | Purchases as conversions, with their revenue | Goals |
| Server-side events | Orders sent from your backend, which nothing in the browser can block | Server-side events |
Set it up
Install it
Add the snippet from Analytics → Install to every page. The Install screen has snippets for Shopify, WordPress and Webflow as well as the frameworks (Install Analytics).
Send the shopping steps
src/shop.ts1import { track } from "@viakite/sdk";23track("Product viewed", { product: "Pro yearly" });4track("Add to cart", { product: "Pro yearly" });5track("Checkout started");Send each purchase once, from your server
Send the order when it is paid, from the handler that confirms it. Give it the order id as the event
id, so a retry is stored once:src/orders.ts1import { Viakite } from "@viakite/node";23const viakite = new Viakite({ secretKey: process.env.VIAKITE_SECRET_KEY!, project: "prj_…" });45export function orderPaid(order: Order, req: Request) {6viakite.track(7"Purchase",8{ revenue: order.total / 100, currency: order.currency, items: order.items.length },9{ id: order.id, userId: order.customerId, ip: req.ip, userAgent: req.headers["user-agent"] },10);11}order.total / 100turns cents or paise into the main unit. Passing the buyer'sipanduserAgentties the purchase to their visit and its source. On a thank-you page in the browser, the same call istrack("Purchase", { revenue: 499, currency: "INR" }).Or let your payment provider send it
Taking payments with Stripe, Razorpay or Dodo Payments? Connect it in Settings → Payment providers instead, put
viakite_user_idin each payment's metadata (notes on Razorpay), and callidentify(user.id)on the pages buyers see. Each payment becomes aPaymentevent with its revenue. Full steps: Payment providers.Make a goal and a funnel
In Analytics → Goals, add an event goal
Purchase(orPaymentfrom a provider): its row shows conversions, conversion rate and revenue. In Analytics → Funnels, make Product viewed → Add to cart → Checkout started → Purchase, and click a step's drop to see where those shoppers went instead.
Then open Analytics → Revenue for revenue, orders, average order value, revenue over time and revenue by source.
What to watch
- Count each sale once. Not on page reloads, not on retries without an event
id, and not from both your code and a connected provider. - Amounts in the main unit.
499for ₹499 and19.99for $19.99. Revenue sent as text ("499") is dropped. - Currencies. Rates are the European Central Bank's daily rates, about 30 currencies. A currency without a rate (such as
AED) is left out of revenue; convert those before you send them. - Anonymous shoppers last a day. A funnel counts a visitor who goes through every step within a day. For longer journeys, identify signed-in customers and count users (up to 30 days).
- Provider payments need a recent visit. A payment is counted as revenue only when its
viakite_user_idwas seen in the 30 days before it.