Your customers want to see and explore their data inside your product — dashboards, charts, reports, and the freedom to slice it themselves — without exporting to a spreadsheet or logging into a separate tool. This guide walks through how to implement embedded analytics in a SaaS application, the customer-facing kind where every tenant must see only their own data.

It's written for product and engineering leaders. The order of the steps matters: the parts that decide whether your build survives contact with real customers come first, and the visible UI comes later than most teams expect.

TL;DR

Implement embedded analytics from the data outward, not the UI inward. The reliable path: (1) model your metrics in a semantic layer so every chart, API, and feature reads the same governed definitions; (2) enforce multi-tenant row-level security at the data layer so each customer sees only their data; (3) pick an embed surface — iframes for the fastest drop-in, an SDK / Core Data APIs for a custom UI, Creator Mode for in-app authoring, an Analytics Chat API for conversational analytics; (4) add pre-aggregation caching for performance under concurrent load; (5) theme / white-label it to match your product; (6) optionally add an AI analyst grounded in the semantic layer; (7) ship a thin slice and iterate. The charts are the easy part; the multi-tenant, governed foundation is the work. Cube is the agentic analytics platform built on a semantic layer (its open-source core, Cube Core), multi-tenant by construction, with all four embedded surfaces — Brex built its embedded financial analyst, Spaces, on it.

What teams get wrong about embedded analytics

The instinct is to start with the UI: grab a charting library, wire it to the production database, and ship a "Reports" tab. That demos well and then stalls, because the hard parts of embedded analytics aren't visible in a single-tenant demo:

  1. Consistency. When each chart writes its own query against raw tables, business logic gets re-derived per component. "Active users" means one thing on the overview and another on the billing page, and you can't explain the difference to a customer.
  2. Isolation. In a multi-tenant product the catastrophic failure isn't a slow chart — it's one customer seeing another customer's data because a front-end query forgot a tenant filter. Access control cannot live in the UI.
  3. Performance under load. A dashboard that's snappy for one tenant degrades when fifty tenants load it at once and a few run heavy queries. Without caching, latency and warehouse spend climb with every customer you add.
  4. Maintenance. Charts wired directly to tables break when a column changes. Every metric is defined in N places, so a change is N edits and a regression hunt.

The fix for all four is to put a governed layer between your product and the warehouse. Build the experience your customers love on top of a foundation that already encodes your metrics, your access rules, and a fast query path. That's the order the steps below follow.

Step 1 — Model your metrics in a semantic layer

Start here, before any chart. A semantic layer is one governed definition of your metrics (revenue, active users, MRR), dimensions, entities, joins, and access policies. Every consumer — dashboards, charts, APIs, and later any AI feature — reads the same definitions, so the numbers match across your entire product.

This is what converts "a pile of charts that disagree" into "a product surface you can trust." Define a metric once; every embedded surface inherits it.

With Cube, this layer is Cube Core — the open-source (Apache 2.0) semantic layer at the foundation of the platform. A few practical notes:

  • It sits on top of your warehouse. Cube connects to Snowflake, BigQuery, Redshift, or Databricks; it does not replace them. Your data stays where it is.
  • It can reference your dbt models. If you already transform data with dbt, you don't rebuild it. dbt models the data; the semantic layer governs the metrics on top and serves them to embedded apps, internal BI, and AI. Use dbt for shared persistent logic and the semantic layer for the query-time metrics your product exposes.
  • It's SQL-first and extensible at query time. Your governed definitions stay intact while individual surfaces build ad-hoc calculations on top, so you can go beyond the pre-built metrics without forking the model.

Model the handful of metrics and dimensions your customers actually need first. You can grow the model later; you can't embed metrics that don't exist yet.

Step 2 — Enforce multi-tenant access control

In embedded analytics this is the step that protects the business. Every query a customer makes must be scoped to that customer's data, and that scoping has to happen at the data layer — not in front-end code, not in a query string the browser can edit.

The standard pattern:

  1. Your backend authenticates the user and issues a signed token (typically a JWT) carrying a security context — for example, the tenant ID and role.
  2. The semantic layer reads that context and applies row-level, multi-tenant security to every query it generates, regardless of which surface or component asked.
  3. Because the rules live in the semantic layer, every embedded surface inherits them automatically. A dashboard, a custom chart, and an API call are all scoped the same way, from one definition.

Defining isolation once and having it flow to every surface is the whole point. The alternative — re-implementing the tenant filter in each chart and each endpoint — is where embedded analytics leaks customer data. Verify it the boring way: sign a token for tenant A, attempt to retrieve tenant B's rows through every surface, and confirm you can't.

Step 3 — Choose your embed surface

How analytics shows up in your product depends on how custom the experience needs to be, and how much UI you want to own. Cube offers four surfaces; pick by goal, not by default.

Embed surfaceBest forWhat you getEffort
iframesThe fastest drop-inA governed dashboard embedded with a signed security token and minimal front-end workLowest
SDK / Core Data APIsA fully custom UIDirect, governed access over SQL, REST, and GraphQL to build any experience and bring your own charting libraryHigher
Creator ModeIn-app authoringLet customers build and save their own views and reports inside your productMedium
Analytics Chat APIConversational / agentic analyticsA governed endpoint your UI — or an AI agent — calls to ask questions and receive structured answersHigher

A common pattern: start with an iframe to ship something governed in days, then move your highest-value flows to a custom UI on the Core Data APIs as you invest in bespoke design. The security context from Step 2 flows through every surface, so you're not re-solving isolation when you switch. For the broader platform decision around these surfaces, see our guide to the best embedded analytics platforms in 2026.

Step 4 — Cache for performance under load

Embedded analytics is read-heavy and concurrent. The same dashboard is loaded by many tenants at once, and a few will run heavy queries. Without a caching strategy, latency and warehouse spend scale with adoption — the opposite of what you want as the product succeeds.

Cube's pre-aggregations materialize common query shapes into optimized rollups, so frequent dashboards are served from the cache instead of round-tripping to the warehouse every time. In practice:

  • Pre-aggregate the metric and dimension combinations your customers hit most — the default dashboards, the common date ranges — and let the warehouse handle the long tail of novel queries.
  • Design for concurrency, not just single-query latency. Multi-tenant embedded load is about many simultaneous queries; a query that's fast in isolation can still pile up.
  • Watch tenant isolation in performance, too. A platform that's multi-tenant by construction keeps one tenant's heavy query from degrading everyone else's dashboards.

Performance is also a trust signal: a dashboard that paints in a second feels reliable; one that spins for fifteen feels broken, no matter how correct the numbers are.

Step 5 — Theme and white-label to match your product

Embedded analytics should look like part of your product, not a third-party tool bolted into an iframe. How you theme depends on the surface you chose in Step 3:

  • With the SDK / Core Data APIs, you build the entire front-end, so theming is simply your own UI and your own components — fonts, colors, layout, interactions all match because they're yours.
  • With iframes and pre-built components, apply your colors, fonts, and styling so the analytics blend in, and remove vendor branding for a white-labeled experience your customers perceive as native.

Decide early how much UI you want to own, because it drives the surface choice as much as the other way around. Teams that need pixel-perfect, brand-native analytics tend toward the APIs; teams optimizing for time-to-ship lean on iframes and components and theme them.

Step 6 — Optionally add an AI analyst

Once governed dashboards and self-serve querying are live, you can let customers ask questions in plain language. This is an optional, later step — ship the visual experience first — but it's increasingly expected, and the foundation you built makes it tractable.

The one rule: ground the AI in the semantic layer, not raw text-to-SQL. An LLM pointed at raw tables doesn't know your join paths or which numbers are certified, and it has to be trusted to write the tenant filter correctly on every prompt. An agent grounded in the semantic layer selects from certified metrics, and the platform generates the query — so answers are consistent, explainable, and automatically scoped to each tenant by the same security context your dashboards use.

Cube exposes governed metrics to agents over an Analytics Chat API and an MCP server (the Model Context Protocol, the emerging standard for connecting agents to tools and data). This is its own substantial topic, so we've written a dedicated companion guide: how to add AI analytics to your product. Brex built Spaces — an embedded financial analyst its customers query directly — on Cube this way, choosing it over the dbt Semantic Layer and LookML because the semantic layer is what makes the AI useful.

Step 7 — Ship, then iterate

Get a thin slice in front of real customers early: a few governed metrics, strict tenant isolation, one embed surface, pre-aggregations on your hottest dashboards, and your theme applied. Then iterate on what customers actually do.

  • Add metrics and dimensions in response to real usage, not anticipated needs. The filters and breakdowns customers reach for are your roadmap for the semantic layer.
  • Tune pre-aggregations against observed query patterns as adoption grows and new dashboards become popular.
  • Expand surfaces from a quick iframe to a custom UI for your highest-value flows, and add the AI analyst (Step 6) when customers start asking for it.

Because every surface reads the same governed model, each metric you add improves the dashboards, the custom UI, the APIs, and any AI feature at once. That compounding is the payoff of starting with the semantic layer.

Note

Build vs. buy. You can build all of this in-house, but be honest about where the time goes. The expensive parts aren't the charts — they're the governed semantic layer, multi-tenant row-level security, caching under concurrent load, and (if you add it) an AI layer grounded in the model. That's a multi-quarter platform project most teams underestimate by an order of magnitude. The pragmatic split for most SaaS teams is to buy the foundation and build the front-end your customers see. We lay out the full tradeoff, with a decision table, in build vs. buy embedded analytics.

Implementation checklist

  • Metrics modeled in a semantic layer (start with what customers actually need; reference existing dbt models rather than rebuilding them).
  • Warehouse connected (Snowflake / BigQuery / Redshift / Databricks) — semantic layer on top, not a replacement.
  • Multi-tenant security enforced at the data layer via a signed security context (e.g., a tenant ID and role in a JWT); verified that a tenant cannot retrieve another tenant's rows through any surface.
  • Embed surface chosen by goal: iframe (fastest), SDK / Core Data APIs (custom UI), Creator Mode (in-app authoring), or Analytics Chat API (conversational / agentic).
  • Pre-aggregations configured for the highest-traffic dashboards; concurrency tested under realistic multi-tenant load, not a single-tenant demo.
  • Theming / white-label applied so the analytics look native to your product; vendor branding removed where you want it gone.
  • AI analyst (optional) grounded in the semantic layer over the Analytics Chat API / MCP — not raw text-to-SQL against raw tables — when customers want plain-language querying.
  • Iteration loop in place: add metrics for real usage, retune caching, expand surfaces.

When building it yourself is still the right choice

Be honest about your situation. Rolling your own embedded analytics can make sense if it's a single-tenant internal tool with no isolation requirements, a throwaway prototype, or one or two static charts that don't need self-serve querying, governance, or AI — and if you have data engineers to own it. In those cases the overhead of a platform may not pay off yet.

The calculus flips the moment the feature is customer-facing, multi-tenant, and expected to stay correct and fast as you add tenants. That's when the semantic layer, isolation, and caching stop being optional infrastructure and become the bulk of the work — and the thing that lets you ship.

Our verdict

To implement embedded analytics for a SaaS product the way it'll survive real customers: model your metrics in a semantic layer, enforce multi-tenant access control at the data layer, choose an embed surface for your goal, cache with pre-aggregations, theme it to match your product, optionally add an AI analyst grounded in the model, then ship and iterate. That's the architecture behind Brex Spaces, built on Cube — the agentic analytics platform whose open-source core, Cube Core, is the semantic layer that makes every surface consistent and every tenant isolated. Build the experience your customers love; buy the governed foundation that makes the answers trustworthy.

Methodology

This guide reflects the architecture we see work for customer-facing embedded analytics as of 2026: a semantic layer at the foundation, multi-tenant access control enforced at the data layer, an embed surface matched to the use case, pre-aggregation caching for performance under concurrent load, theming to match the host product, and — optionally — an AI analyst grounded in governed metrics (increasingly over MCP). Product capabilities and standards like MCP evolve quickly, so confirm specifics against current documentation. As the publisher, Cube has an obvious interest here; we've aimed to describe the build-vs-buy tradeoff fairly and to be explicit about when building it yourself is the better call.