Guide
Embedded analytics without the rebuild
What customer-facing analytics needs beyond a chart library, and how embedding works in DataSquares.
2 min read
The build-it-ourselves trap
Most software products eventually need an analytics page, and a chart library makes the first version look easy. The work arrives later: filters that persist, exports, time zones, drill-down, access rules for every customer, and a queue of chart requests competing with the product roadmap.
What embedding actually requires
Three things separate embedded analytics from an iframe demo. Tenant isolation: one customer must never see another's rows, enforced where the query runs rather than in the page. Session security: short-lived tokens that your server issues for one viewer and one dashboard, so the browser never holds a lasting credential. And presentation that fits your product: your logo and colors, and control over what viewers can do.
Row-level filtering is the heart of it. One dashboard definition, filtered for each customer by the identity in the token, can serve every customer, and that is what keeps it maintainable.
How embedding works in DataSquares
Build the dashboard once. When a customer opens your analytics page, your server asks DataSquares for an embed token for that dashboard, with an expiry and a row context such as the customer's tenant ID. The row context is bound into the token on the server: the viewer cannot see or change it, and every query the embed runs is scoped by it.
Show the dashboard with an iframe or with the React component, which adds events for clicks and filter changes and lets your page set parameters and switch pages. Allowed domains decide where the embed may render; the token remains the credential.
The embed carries your logo and the dashboard's theme, with a small Powered by DataSquares credit. Settings decide whether the toolbar shows and whether viewers may export. Embedding in your own apps is available on the Business plan, and customer-facing embedding is part of Enterprise.
Before you ship
Set token expiries to the length of a session, and list the domains allowed to show the embed. Decide whether viewers may export. Leave Ask AI for viewers off unless you mean to offer it: it is off by default, and when turned on it answers only from that share's own cards. Then watch the usage panel, which counts views, chart clicks, filter changes and page switches for each share, to see which embeds people actually use.