Embedded analytics for SaaS - Ship customer dashboards in days

Embedded analytics for SaaS products

Almost every B2B SaaS product reaches the same point. Customers start asking, "How many people clicked my link this week? Which country are my visitors from? Which pages convert?" Litemetrics is the answer that does not require you to spend a quarter building charts.

The problem this solves

You are building a product where customers create things (sites, forms, links, products, posts, surveys, anything) and they want to see how those things perform. You have three options:

  1. Build it yourself. Pick a charting library, design a dashboard, build an aggregation pipeline, deal with multi-tenancy, write retention queries. Three engineer-months minimum.
  2. Iframe a third-party tool (Plausible, Umami, GA). Looks foreign, breaks your design system, leaks customer data to a vendor, exposes your customers to that vendor's terms.
  3. Embed Litemetrics. Drop one component into your app, pass a customer's siteId, ship the feature tomorrow.

What you get

  • A pre-built React dashboard: stat cards, time series, top pages, top referrers, geo, browser, device, scroll depth, button clicks. Native components, not iframes.
  • Multi-tenant by default: every customer has a siteId and a secret. Their data is scoped on the server side; you cannot accidentally leak.
  • Themeable: 10 built-in presets and full CSS variable control. Match your brand without forking the component.
  • Self-hosted: runs on your infra. ClickHouse, Postgres, or MongoDB. No vendor lock-in, no per-event pricing.
  • Light tracker: 3.5 KB gzipped. Your customers' users do not pay an LCP cost for analytics they did not ask for.

The integration shape

Three pieces wire up in your app. The pattern is the same whether you have ten customers or ten thousand.

1. Provision a site per customer

When a customer signs up (or whenever they create the resource you want analytics for), call your collector's site CRUD endpoint to provision a site:

async function createCustomerSite(customer) {
  const res = await fetch('https://analytics.yourapp.com/api/sites', {
    method: 'POST',
    headers: {
      'X-Litemetrics-Admin-Secret': process.env.LITEMETRICS_ADMIN_SECRET,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      name: customer.name,
      hostnames: [customer.subdomain + '.yourapp.com'],
    }),
  });
  const { siteId, secretKey } = await res.json();
  await db.customers.update(customer.id, {
    litemetricsSiteId: siteId,
    litemetricsSecret: secretKey,
  });
}

2. Drop the tracker on your customer's storefront / page / product

Whatever your customer publishes, include the tracker pointed at their siteId:

<script src="https://analytics.yourapp.com/litemetrics.js" defer></script>
<script>
  Litemetrics.createTracker({
    siteId: '{{ customer.litemetricsSiteId }}',
    endpoint: 'https://analytics.yourapp.com/api/collect',
  });
</script>

3. Render the dashboard inside your product

import {
  LitemetricsProvider,
  AnalyticsDashboard,
} from '@litemetrics/ui';

export function CustomerAnalytics({ customer }) {
  return (
    <LitemetricsProvider
      baseUrl="https://analytics.yourapp.com/api"
      siteId={customer.litemetricsSiteId}
      secretKey={customer.litemetricsSecret}
    >
      <AnalyticsDashboard theme="midnight" />
    </LitemetricsProvider>
  );
}

The economics

Hosted analytics platforms (PostHog, Mixpanel, Amplitude) charge per event. At 100 customers each generating 50,000 events a month, that is 5M events. On most platforms that lands you on a four-figure monthly bill before you have made a dollar from those customers. Litemetrics is one VM and one database; the marginal cost per customer is essentially zero.

Real-world fit

This shape is everywhere:

  • Link-in-bio tools (every link gets analytics).
  • E-commerce builders (every store gets analytics).
  • CMS / page builders (every site gets analytics).
  • Form / survey tools (every form gets analytics).
  • Booking / scheduling tools (every page gets analytics).
  • Newsletter / blog platforms (every post gets analytics).
  • Portfolio / creator platforms (every profile gets analytics).

Get started