Tenant analytics

Measure your customers' pages from your own server with no tag, cookie or person, give each tenant a signed embed or a media-kit link that shows only its numbers, and run tenant A/B tests with local assignment.

Embed
Preview of the card
<a href="https://lucidace.com/help/tenant-analytics"><img src="https://lucidace.com/help/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/2f4b888b-c4e6-488b-81bd-6e838fb12d2e/pages/a59d75ac-73c2-40e7-8f29-ae6bebc67682/social-card.svg?v=3e7ae33eec8b" alt="Tenant analytics" width="600" height="315"></a>

A platform with its own customers (creators, shops, workspaces: "tenants") can measure the tenants' public pages from its server and show every tenant its own numbers. Nothing runs in the visitor's browser, nothing is written to the visitor's device, and Lucida never receives an identifier of the visitor.

Send events

One server-side call per pageview or click, from your route handler, with a secret key:

POST https://capture.lucidace.com/v1/projects/<project_id>/tenant-events
Authorization: Bearer <secret key>
Content-Type: application/json

{"events": [
  {"tenant_id": "creator-42", "event": "$pageview", "url": "https://lnk.example/alice", "referrer": "https://google.com/", "country": "US", "ua_class": "mobile"},
  {"tenant_id": "creator-42", "event": "click", "target": "link-7", "value": 12.5}
]}

Field

tenant_id

required, 1 to 128 characters

event

required, e.g. $pageview, click, $exposure; not $lc_*

url

the query string and fragment are dropped

referrer

only the host is kept (www. removed)

country

ISO 3166 alpha-2 (from your CDN header)

ua_class

desktop, mobile, tablet, bot or other; bot rows are left out of every read

target

what was clicked, e.g. a link id

value

a number to sum, e.g. revenue

experiment_id, variant

together, for tenant experiments

uuid

dedupe key for retries; made for you when absent

timestamp

RFC 3339, within the project's retention; default now

Up to 1000 events per call (a single event object also works). The answer is {"accepted": n, "rejected": [{"index", "reason"}]}. Any other field (a distinct id, an IP address, a user agent) is ignored and never stored. Delivery is at least once; a retried event with the same uuid counts once.

With @lucida-analytics/node 0.1.6:

import { tenantEvent } from "@lucida-analytics/node";
// LUCIDA_SECRET_KEY and LUCIDA_PROJECT_ID in the environment
await tenantEvent({ tenantId: creator.id, event: "$pageview", url: req.url, referrer: req.headers.get("referer") ?? undefined, country: req.headers.get("cf-ipcountry") ?? undefined, uaClass: "mobile" });

The tenant lane is aggregate measurement: no identifier of the visitor is received or stored, no cookie or storage is used, and no profile is built. It never passes the person consent gate, so server_event_consent: require_granted does not apply and no consent is stamped. Your own consent banner settings for your own pages are unaffected. You remain the controller and decide whether your jurisdiction treats such measurement as exempt.

Read one tenant's numbers

From your server (secret key or session, needs insight:read):

GET /v1/projects/<project_id>/tenants/<tenant_id>/stats?days=30&event=$pageview,click&breakdown=referrer

{"tenant_id": "creator-42", "from": "...", "to": "...", "days": 30,
 "series": [{"day": "2026-11-24", "event": "$pageview", "count": 120, "value": 0}],
 "breakdown": "referrer", "breakdown_rows": [{"key": "google.com", "event": "$pageview", "count": 40, "value": 0}]}

days is 1 to 400 (default 30, UTC days, ending today); event is a comma list (default: all); breakdown is url, referrer, country, ua_class or target (top 100).

Embed tokens

Mint a signed token for one tenant and hand it to the tenant's dashboard page:

POST https://lucidace.com/v1/projects/<project_id>/embed-tokens
{"tenant_id": "creator-42", "ttl_seconds": 3600, "allowed_origins": ["https://linkhub.example"], "events": ["$pageview", "click"], "theme": "dark"}

The 201 carries token, expires_at, embed_url and api_url:

  • embed_url (/v1/embed/tenant/<token>) is an iframe page with a daily chart and, with ?breakdown=, a table. It takes ?days=, ?event=, ?breakdown= and ?theme=light|dark|system, sends Content-Security-Policy: frame-ancestors <allowed_origins> and posts {type: "lucida:dimensions", height} to the parent for auto-height. Allow it in your CSP with frame-src https://lucidace.com.

  • api_url (/v1/public/tenant/<token>) returns the same JSON as the stats route.

A token reads only its tenant and only its events (when set); the URL cannot name another tenant. A browser call must come from one of allowed_origins. Tokens last 60 seconds to 24 hours (default 1 hour) and cannot be revoked, so mint them per page load. Minting needs insight:read, so a read-only key is enough. Expired, forged and foreign-origin tokens are 404.

A tenant share link lasts until you revoke it (or expires_in_days, 1 to 3650), with no organization permanent_shares switch needed, because it only ever shows one tenant's aggregates:

  • POST /v1/projects/<project_id>/tenants/<tenant_id>/shares {"allowed_origins": [], "theme": "light", "hide_branding": false} returns the share with its token (once), embed_url and api_url.

  • GET on the same route lists them; DELETE .../shares/<share_id> revokes one, after which its URLs answer 404.

Tenant experiments

Create (needs experiment:write):

POST https://lucidace.com/v1/projects/<project_id>/tenant-experiments
{"tenant_id": "creator-42", "name": "Hero button", "variants": [{"key": "control"}, {"key": "big", "weight": 1}], "metric": "click"}

Assign locally, with zero calls to Lucida. The algorithm, so any language can implement it:

  1. h = int(sha256_hex(experiment_id + "." + bucket_id)[0:13], 16) / 16^13 (a number in [0, 1)).

  2. Walk the variants in order, adding weight / sum(weights); the first variant whose running total exceeds h wins.

bucket_id is any stable opaque string you derive yourself, for example a salted hash of your own visitor key; Lucida never sees how. In Node:

import { assignVariant, tenantEvent } from "@lucida-analytics/node";
const variant = assignVariant(bucketId, experiment); // experiment from GET .../tenant-experiments/<id>, cache it
await tenantEvent({ tenantId, event: "$exposure", experimentId: experiment.id, variant });
// later, on the metric event:
await tenantEvent({ tenantId, event: "click", experimentId: experiment.id, variant });

Send one $exposure per bucket (dedupe on your side: the lane counts events, not people). Results:

GET /v1/projects/<project_id>/tenant-experiments/<id>/results returns, per variant, exposures, conversions, rate, value, lift and p_value (two-proportion z test against the first variant) with significant at p < 0.05, plus srm (sample-ratio check, flagged below p 0.001, from 100 exposures). PATCH .../<id> {"status": "stopped"} ends a test (assignVariant then returns the control); DELETE removes it. A variant's key is fixed (events carry it), but its display name can change at any status: PATCH .../<id>/variants/<key> {"name": "Big button"} (audited as tenant_experiment.variant_renamed); name is also accepted per variant on create, and results returns it as variants[].name. List with GET .../tenant-experiments?tenant_id=.

Limits and retention

Ingest uses the project's event rate limit (cost = events per call) and plan quota. Rows are kept for the project's retention (default 400 days). Public token reads are cached for a minute.

Updated