BTST

Analytics Plugin

Self-hosted page views, custom events, and a traffic dashboard without cookies

Full-stackReleased · Preview

Best for

Teams adding traffic analytics to a BTST application while keeping event collection and storage under their control.

Measure page views and custom events in your own database without browser cookies.

Real BTST Analytics dashboard with synthetic local page and event activity.
Analytics presents locally recorded activity rather than production audience metrics.

BTST supplies

  • First-party page view and custom event ingestion without cookies
  • Traffic dashboard, date filters, real-time visitors, and CSV export
  • Aggregation operations and configurable event retention

You supply

  • A BTST database adapter and dashboard authorization rules
  • A session secret shared across server instances
  • A scheduled cleanup job for retention when traffic is inactive
  • Application privacy policy and appropriate custom event properties

You own and customize

Events stay in your database. Your application supplies access rules, a session secret, retention scheduling, and a privacy policy.

Compatibility and dependencies

Maintained: Next.js 15+ App Router, React Router v7, TanStack Start.

Requires: A BTST database adapter.

External services: None required.

From registration to result

A semantic workflow, not a setup shortcut

  1. 1Collect activity

    Track BTST route views automatically and send named custom events from application actions.

  2. 2Review traffic

    Choose a date range and compare page views, anonymous visitors, top pages, referrers, and events.

  3. 3Use the data

    Embed authorized aggregation queries, export CSV, and clean up expired events.

Analytics stores page views and custom events in your BTST database. The client sends first-party beacons without adding a third-party script or setting cookies. The dashboard shows traffic, referrers, custom events, and recent visitors.

Registration

Install @btst/plugin-analytics@1.2.0 alongside @btst/stack@6.2.0. Analytics uses the shared Core runtime without other plugin packages or the optional standalone components package. Import its stylesheet for the dashboard.

Follow the framework installation guide, then register both halves under the canonical analytics key:

lib/stack.ts
import { createBackendStack } from "@btst/stack/api"
import { analyticsBackendPlugin } from "@btst/plugin-analytics/api"

export const myStack = createBackendStack({
  basePath: "/api/data",
  adapter,
  auth: serverAuth,
  plugins: {
    analytics: analyticsBackendPlugin({
      retentionDays: 90,
      sessionSecret: process.env.ANALYTICS_SESSION_SECRET,
    }),
  },
})

Use a persistent database adapter in production. Set ANALYTICS_SESSION_SECRET to a private random value of at least 16 characters shared by every server instance so anonymous session hashes are consistent across instances.

lib/stack-client.tsx
import { createClientStack } from "@btst/stack/client"
import { analyticsClientPlugin } from "@btst/plugin-analytics/client"

export function getStackClient(queryClient, origin: string) {
  return createClientStack({
    api: { baseURL: origin, basePath: "/api/data" },
    site: { baseURL: origin, basePath: "/pages" },
    queryClient,
    plugins: { analytics: analyticsClientPlugin() },
  })
}
globals.css
@import "@btst/plugin-analytics/css";

Mount the resolved stack in StackProvider with your framework router and client auth adapter. Shared API, site, and query client configuration belongs on the stack, not in analytics options.

Authorization

Register analyticsPermissions from @btst/plugin-analytics/permissions with your application's shared authorization contract. Allow anonymous ingestion separately from dashboard access. For an identity with a role field, these rules restrict reads, exports, and retention cleanup to administrators:

permissions: [analyticsPermissions] as const,
rules: ({ analytics }) => [
  analytics.events.ingest.allow(),
  analytics.dashboard.read.when(({ identity }) => identity?.role === "admin"),
  analytics.dashboard.export.when(({ identity }) => identity?.role === "admin"),
  analytics.events.cleanup.when(({ identity }) => identity?.role === "admin"),
],

The dashboard uses the same authorization policy as the backend. It remains a dynamic route; do not statically generate protected analytics data. With Next.js, keep it in a request-rendered layout with dynamic = "force-dynamic".

Automatic page views

The analytics client plugin subscribes to onRouteRender. When a BTST route renders in the browser, it sends the path to the ingestion API. Query strings and fragments are removed. Server rendering does not send a page view.

Set analyticsClientPlugin({ tracking: false }) to disable automatic tracking. Routes outside BTST need an explicit tracker call after their router navigates.

Custom events

After the analytics plugin has registered its browser runtime, use track:

import { track } from "@btst/plugin-analytics/client"

await track("signup_completed", { plan: "pro" })

For pages outside BTST or an explicit destination, create a tracker:

import { createAnalyticsTracker } from "@btst/plugin-analytics/client"

const analytics = createAnalyticsTracker({ apiBasePath: "/api/data" })
await analytics.track("button_clicked", { label: "Request demo" })

The plugin reuses public endpoints.analytics.api.browserHeaders for collection. Standalone trackers accept headers for the same purpose. Custom headers use keepalive Fetch instead of a beacon; requests retain the JSON content type.

Properties accept a flat object of strings, finite numbers, booleans, and null. Do not send names, email addresses, account identifiers, or other personal data. The server bounds the event name, path, and properties before accepting a record.

Dashboard

With site.basePath: "/pages", open /pages/analytics. The toolbar contains UTC date and environment selectors, a Funnels button, and an overflow menu for CSV export. The overview includes:

  • Selectable visitor, page-view, bounce-rate, and duration metrics with daily charts.
  • Equal-duration previous-period comparisons. Missing retained history or a zero denominator shows “No prior data” instead of an invented percentage.
  • Exact Pages, grouped Routes, and Hostnames. Pages and route groups each retain inline daily page-view sparklines; route groups do not replace exact URLs.
  • Referrers and the five standard UTM campaign dimensions.
  • Countries, devices, browsers, and operating systems.
  • Custom events with distinct daily anonymous visitors and total occurrences.
  • A live count of sessions with a page view in the last five minutes.

The daily chart supports pointer hover and keyboard focus. A dashed final segment marks the current incomplete UTC day. The daily counts table provides an alternative to the chart. Ranked cards initially show five rows and expand to the returned limit (10 by default, at most 100 through the API).

Funnels opens an accessible side dialog; Escape closes it and restores focus to the trigger. Choose the actual event name rather than relying on a preconfigured purchase event. Metric definitions remain available below the overview.

Analytics dashboard with audience and acquisition cards

The image shows local demonstration traffic. Production dashboards display events ingested by your application.

Audience, campaigns, and deployment context

Browser, device, and operating-system families are derived from the request's user agent. Only those labels are stored, never the raw user-agent string. Detection is approximate: for example, an iPad requesting a desktop identity may appear as a Mac. The browser tracker sends the page hostname, including when the collection API is on another host; it is an untrusted traffic label.

The tracker captures only utm_source, utm_medium, utm_campaign, utm_term, and utm_content from the URL when its in-memory session starts. Those labels stay with subsequent page views until the session expires. Other query parameters and fragments remain excluded. Values are trimmed, limited to 200 characters, and reject control characters. Oversized values are omitted by the tracker without dropping the page view. Do not put personal data in campaign labels.

Country collection is disabled unless the host supplies getCountry. Configure it only for headers your deployment platform sets and protects against spoofing:

analyticsBackendPlugin({
  sessionSecret: process.env.ANALYTICS_SESSION_SECRET,
  environment: process.env.VERCEL_ENV ?? "development",
  getCountry: process.env.VERCEL === "1"
    ? request => request.headers.get("x-vercel-ip-country") ?? undefined
    : undefined,
  getRoute: path => /^\/products\/[^/]+$/.test(path)
    ? "/products/[slug]"
    : path,
})

Country is an approximate two-letter location code, not a precise address. The resolver must not return IPs. Environment labels are server-owned, limited to 64 letters, digits, underscores, or hyphens. Route templates come from the application's explicit resolver; analytics does not guess dynamic path segments. Without a resolver, route values remain Unknown.

The environment selector scopes dashboard metrics, events, live counts, exports, and funnels. The separate experiment reports remain across all environments and do not accept an environment filter. All environments includes historical rows without an environment. Country/browser/OS shares count distinct daily anonymous sessions with each value; one identifier observed with multiple values may occur in more than one group. Missing values are labeled Unknown, including untagged UTM traffic and rows recorded before collection was introduced. No historical data is fabricated.

Schema upgrade

Before deploying this release, regenerate your adapter schema and apply an additive migration. Existing pageView.country, device, and browser fields remain. Add nullable string fields operatingSystem, hostname, route, environment, utmSource, utmMedium, utmCampaign, utmTerm, and utmContent to pageView, and nullable environment to customEvent.

Keep existing rows and indexes. Migrate before starting the new backend; older backends remain compatible with the added nullable columns. Country, campaign, OS, hostname, route, and environment history cannot be backfilled from records that did not store it. Update your application's privacy description to match its enabled collection.

Aggregation API

Use request-bound operations when serving application requests. They run the same authorization and validation as HTTP endpoints:

const analytics = myStack.forRequest(request).operations.analytics
const stats = await analytics.getDashboardStats({ range: "30d" })
const pages = await analytics.getTopPages({ range: "7d", limit: 10 })
const referrers = await analytics.getTopReferrers({ range: "7d" })

// Embed a view count using an authorized server-side query.
const post = await analytics.getDashboardStats({
  range: "30d",
  path: "/blog/introducing-our-product",
})
console.log(post.pageViews)

Trusted server jobs can call myStack.trusted.analytics. Keep trusted operations on the server; do not expose their output without applying your own access policy. Date filters accept range, start, end, path, environment, and limit. Custom ranges require both dates and span at most 366 days; a date-only end includes that UTC day.

Method and path, under api.basePathOperation
POST /analytics/pageviewsrecordPageView
POST /analytics/eventsrecordEvent
POST /analytics/exposuresrecordExposure (opt-in experiments)
GET /analytics/experimentsgetExperimentReport (protected)
GET /analytics/dashboardgetDashboardStats
GET /analytics/pagesgetTopPages
GET /analytics/referrersgetTopReferrers
GET /analytics/eventsgetTopEvents
GET /analytics/realtimegetRealtimeVisitors
GET /analytics/exportexportEvents
POST /analytics/funnelgetFunnel
POST /analytics/funnel/exportexportFunnel
POST /analytics/retentioncleanupExpiredEvents

Conversion funnels

Open Funnels in the dashboard toolbar and configure an ordered sequence, then run it for the selected UTC date range. A step matches either a page view's path (exact or prefix) or an exact, case-sensitive custom event name. Paths use the same normalization as ingestion: query strings and fragments are removed. Definitions accept data only; regular expressions and arbitrary query code are not supported. Funnel definitions are submitted with each query rather than stored as additional database records.

const funnel = await myStack.forRequest(request).operations.analytics.getFunnel({
  range: "7d",
  windowMinutes: 60,
  steps: [
    { type: "pageview", path: "/products/", match: "prefix" },
    { type: "event", name: "checkout_started" },
    { type: "event", name: "purchase" },
  ],
})

console.log(funnel.totalSessions, funnel.convertedSessions, funnel.conversionRate)
console.log(funnel.steps.map(({ sessions, dropOff }) => ({ sessions, dropOff })))

Custom client views can import useFunnelReport from @btst/plugin-analytics/client/hooks inside StackProvider. It uses the stack's query client and authorization partition. Pass null to keep the query disabled; pass the validated definition after submission to load the report. The hook returns the React Query result (data, error, isFetching, and refetch), and does not automatically refetch on window focus or network reconnection.

getFunnel requires analytics.dashboard.read; exportFunnel and the dashboard's funnel CSV export require analytics.dashboard.export. Anonymous ingestion grants neither reporting permission. Both POST endpoints accept the same definition as the operation above. The export returns aggregate step metrics, without raw session identifiers.

Each stored anonymous session is partitioned again by UTC day. A session counts once at each reached step, including an incomplete sequence. It must match the steps at strictly increasing timestamps; equal-timestamp records cannot complete consecutive steps, regardless of database insertion order. Separate occurrences are required for repeated step definitions. Unrelated events are ignored. Repeated first steps can start another candidate sequence, so a later valid start can convert even if an earlier attempt expired. Counts retain the furthest prefix reached across all candidate starts for that session/day.

The conversion window runs from the first matched step to the last matched step, including an event exactly at its upper boundary. Matching never crosses a UTC day, the query's inclusive start/exclusive end, or the retention cutoff. There is no lookback before the selected range and no inference of cross-day visitors or person-level retention. Partial retained sessions contribute only the steps actually observed within those boundaries. The response exposes the effective retention-clamped start and exclusive end.

Configure 2–8 steps and a whole-number window of 1–1,440 minutes. Funnel queries span at most 31 UTC days; date-only end dates include that whole day. The backend filters by timestamp before reading and loads only the record types used by the definition. Each query reads at most 20,000 combined rows plus one overflow sentinel. A query above the row cap returns HTTP 422 instead of a partial report; narrow its date range and retry. This bounds each report's application work, but does not provide pre-aggregated funnel storage. Production adapters should index timestamps for efficient range reads.

Step conversionRate is the percentage of entering sessions that reached that step. dropOff and dropOffRate compare with the previous step; the first step's drop-off is zero. An empty result retains every configured step with zero counts and percentages. Dashboard queries run explicitly, and funnel export uses the same validated definition and counting rules.

Prop

Type

Prop

Type

Experiment exposures and conversions

Experiments are opt-in. Register both plugins yourself and configure Analytics with explicit experiment definitions and a server-side variant resolver. Neither plugin imports or requires the other package. Ordinary flag evaluation, including feature_flag_evaluated lifecycle events, does not record an experiment exposure.

lib/stack.ts
analytics: analyticsBackendPlugin({
  sessionSecret: process.env.ANALYTICS_SESSION_SECRET,
  experiments: {
    definitions: [{
      key: "checkout-test",
      flagKey: "checkout-layout",
      conversionEvent: "signup_completed",
      attributionWindowMs: 30 * 60 * 1000,
    }],
    resolveVariant: async ({ flagKey, sessionId, request }) => {
      const flags = request
        ? myStack.forRequest(request).operations.featureFlags
        : myStack.trusted.featureFlags
      return flags.evaluateExperimentVariant({
        key: flagKey,
        context: { sessionId },
      })
    },
  },
}),
featureFlags: featureFlagsBackendPlugin(),

Experiments require a stable server-only sessionSecret of at least 16 characters. The resolver evaluates the saved definition on the server; the exposure body has no variant label. Its required expectedConfigurationVersion must match the saved definition shown to the visitor; it cannot override the server-resolved version. A changed definition rejects a stale exposure with accepted: false, so re-evaluate and display the new assignment before retrying. Use the same permitted anonymous session for exposure and conversion. If your application explicitly maps a consented session to stronger targeting identity, keep that mapping inside the resolver. Analytics persists only its daily session hash, never raw user IDs, emails, or targeting context. Do not substitute an account identifier for the anonymous session.

Record exposure only when the assigned experience is actually shown. Use the same tracker for the exposure and later custom event:

import { createAnalyticsTracker } from "@btst/plugin-analytics/client"

const analytics = createAnalyticsTracker({ apiBasePath: "/api/data" })

// Obtain the same permitted anonymous key that expose() and track() use.
const sessionId = analytics.getSessionId()
if (sessionId) {
  const context = encodeURIComponent(btoa(JSON.stringify({ sessionId })))
  const response = await fetch(
    `/api/data/feature-flags/experiment-variant/checkout-layout?context=${context}`,
  )
  if (response.ok) {
    const assignment = await response.json()
    if (assignment.variant && assignment.configurationVersion) {
      // Render the experience before recording its exposure.
      renderCheckoutVariant(assignment.variant)
      await analytics.expose("checkout-test", assignment.configurationVersion, "/checkout")
    }
  }
}

// Call only when this application-defined conversion occurs.
await analytics.track("signup_completed", undefined, "/checkout")

The configured default tracker also exports getAnalyticsSessionId() and expose("checkout-test", assignment.configurationVersion) alongside track(). Supply that same anonymous key to Feature Flags evaluation before rendering; a different userId or sessionId can select a different variant. Standalone tracker.getSessionId() returns undefined on the server or when browser Do Not Track is enabled. Exposure collection also rejects Global Privacy Control requests. Browser exposure calls share the tracker's in-memory session and privacy controls. Reloads, separate tabs, or 30 minutes of inactivity may start a new session; counts describe anonymous sessions, not distinct people. These client observations are untrusted analytics and must never authorize a payment, benefit, or protected business operation.

Attribution rules

  • The attribution window defaults to 30 minutes and may be configured up to 24 hours. It always ends at the UTC-day boundary, even if time remains.
  • The first accepted exposure for an experiment, definition version, and daily session starts the window. Repeated exposure/render calls count once and do not renew it. subjects and exposures therefore have equal counts in v1.
  • A conversion is an Analytics custom event whose name matches conversionEvent, received strictly after exposure and within its window. Events before exposure, or at exactly its timestamp, do not qualify. Client timestamps are not accepted.
  • Each subject converts at most once per experiment version. Repeated matching conversion events do not increase that subject's conversion count. Each accepted exposure records an activation separately from the deduplicated first exposure. The latest activation before a conversion determines its owner.
  • Returning to a previous configuration, such as A → B → A after a rollback, makes A active again without increasing its subjects/exposures or renewing its original attribution window. A subsequent conversion belongs to A only while that original window remains valid. An expired active configuration never falls back to another configuration.
  • Exposure calls require the flag fingerprint returned by evaluateExperimentVariant. If the saved definition changes between display and exposure, the call is rejected without a record.
  • Disabled, missing, archived, untargeted, and variant-free flags do not create exposures. Configuration fingerprints separate changed flag definitions; changing the conversion event or attribution window also creates a separate report version. Historical versions remain separate instead of pooling weights.

Protected experiment reports

Grant analytics.experiments.read in the shared authorization contract, for example analytics.experiments.read.when(({ identity }) => identity?.role === "admin"). To add experiment tables to the existing dynamic dashboard, configure analyticsClientPlugin({ experiments: ["checkout-test"] }). Its date filters also apply to the experiment reports.

For an authorized server request:

const report = await myStack.forRequest(request).operations.analytics
  .getExperimentReport({ experimentKey: "checkout-test", range: "7d" })

POST /analytics/exposures records explicit exposure. GET /analytics/experiments?experimentKey=checkout-test&range=7d reads the protected report. Report rows include the persisted flag key, variant, full configurationVersion, conversion event, window, exposed subjects, deduplicated exposures, converted subjects, and conversionRate as a percentage. Reports expose aggregate counts and clear same-session, same-UTC-day boundaries. They do not report statistical significance, confidence intervals, automatic winners, or cross-device identity. The selected range is an exposure cohort: both exposure and conversion must be inside it. Experiment reports do not support path filtering. Apply the adapter's additive schema migrations for both experimentExposure and experimentActivation before running the updated Analytics plugin, even if experiments are disabled. The first table stores unique samples and original attribution windows; the second stores accepted activation history using the same daily anonymous session hash. Retention cleanup removes both kinds of records, including when the bridge is disabled.

Privacy and measurement

The tracker keeps its anonymous session identifier in memory rather than browser storage. Reloading or opening another tab can start a new session, so unique visitor counts are estimates rather than a count of distinct people. The server hashes session identifiers with a daily salt before storage and never stores raw IP addresses. Daily rotation also separates the same session across UTC days. Referrer analytics retain the external host rather than sensitive URL details. The tracker and ingestion API honor Do Not Track and Global Privacy Control. Recognized bots are filtered by user agent; this reduces crawler traffic but does not authenticate human visitors.

Bounce rate measures sessions with one page view. Session duration measures the time between the first and last recorded page view, averaged across sessions including bounces as zero. Visits split after 30 minutes of page-view inactivity. Custom events do not change bounce rate or session duration. Leaving a page open does not produce a heartbeat. Date filters and retention can shorten the activity visible to these calculations.

Custom properties and page paths are application-controlled. Avoid putting personal data in paths or event properties. Your application owns its event properties and privacy policy.

Retention and hooks

retentionDays defaults to 90. Schedule cleanup to remove expired records even when your site receives no traffic:

await myStack.trusted.analytics.cleanupExpiredEvents({})

Use lifecycle hooks for application-specific filtering and observation. Hooks run inside the validated, authorized ingestion operation; access control belongs in the shared authorization rules. Explicit experiment exposures also invoke these hooks with kind: "exposure", the experiment key, assigned variant, configuration version, and hashed session. Rejecting onBeforeIngest prevents exposure persistence, so application filters and rate limits can apply before collection.

analyticsBackendPlugin({
  hooks: {
    onBeforeIngest: async (event) => {
      if (event.path.startsWith("/internal")) throw new Error("Excluded path")
    },
    onAfterIngest: async (event) => {
      console.log("Analytics event recorded", event.path)
    },
  },
})

Lifecycle bridges

Analytics 1.1 adds typed helpers for Feature Flags, Form Builder, Newsletter, Calendar, Ecommerce, and School. The source plugins remain independently installable. Analytics imports none of those packages.

import { createAnalyticsServerHooks } from "@btst/plugin-analytics/api"

const analyticsHooks = createAnalyticsServerHooks({
  recordEvent: (event) => myStack.trusted.analytics.recordEvent(event),
  session: async ({ request }) => {
    // Resolve your application's existing consented anonymous session.
    // Return null when collection is not permitted; never use an email or user ID.
    return resolveConsentedAnonymousSession(request)
  },
})

// Inside the corresponding plugin registration:
featureFlagsBackendPlugin({ hooks: analyticsHooks.featureFlags })
formBuilderBackendPlugin({ hooks: analyticsHooks.formBuilder })
newsletterBackendPlugin({ ...newsletterOptions, hooks: analyticsHooks.newsletter })
calendarBackendPlugin({ hooks: analyticsHooks.calendar })
ecommerceBackendPlugin({ ...checkoutOptions, hooks: analyticsHooks.ecommerce })
schoolBackendPlugin({ hooks: analyticsHooks.school })

The server resolver must return an opaque session ID of 16–128 characters or null. Use the same consented anonymous session for flag exposure and conversion events to correlate them. Analytics validates events, hashes sessions daily, runs ingestion hooks, and applies retention through trusted.analytics.recordEvent. The helper skips requests with DNT: 1 or Sec-GPC: 1 before calling the resolver.

Calendar and School lifecycle hooks have no HTTP request argument. Payment webhooks contain the provider request, not the customer's original browser session or consent. Their correlation and consent therefore remain application responsibilities; the helpers never reconstruct identity from user IDs, emails, cookies, or entity IDs. Do not enable collection for request-less callbacks until your application can resolve that consented context.

Source callbackEventProperties
Feature Flags onEvaluatefeature_flag_evaluatedflag, boolean result, actual assigned variant or null
Form Builder onAfterSubmissionform_submittedformId
Newsletter onAfterSubscribenewsletter_subscribednone; subscribed records only
Calendar onAfterConfirmBookingbooking_confirmedeventTypeId; newly confirmed records only
Calendar onAfterRescheduleBookingbooking_rescheduledeventTypeId; confirmed records only
Ecommerce onAfterOrderPaidorder_paidrevenue in minor units (subtotal - discount), currency
School onAfterEnrollcourse_enrolledcourseId; enrolled or completed records, including paid-hook retries
School onAfterCourseCompletecourse_completedcourseId; completed records only

Paths use static source paths (/feature-flags, /forms, /newsletter, /calendar, /store, /learn), without request queries or tokens. No submission fields, contact details, addresses, payment/cancellation credentials, flag payloads, or targeting context are copied. Properties remain subject to Analytics' normal size/type validation. These filters are not an anonymization service for custom property values or application-defined flag keys.

Compose application hooks explicitly instead of replacing them:

hooks: {
  ...existingHooks,
  onAfterOrderPaid: async (order, context) => {
    await existingHooks.onAfterOrderPaid?.(order, context)
    await analyticsHooks.ecommerce.onAfterOrderPaid(order, context)
  },
}

Calendar still calls the legacy confirmation notification after rescheduling, with optional { reason: "rescheduled" } context. The Analytics helper ignores that notification and emits only booking_rescheduled, so rescheduling does not increase confirmation conversions.

Errors propagate to the source lifecycle. Existing verified-payment callbacks can retry, so analytics event delivery can be repeated. These helpers do not add exactly-once delivery or transactional outboxes. School's new completion observer runs after the first committed transition, even when certificates are disabled; it is not automatically retried and does not replace the certificate generator.

For a browser-observed lifecycle, use createAnalyticsClientHooks from @btst/plugin-analytics/client with the same createAnalyticsTracker() instance used for page views. Without an argument it uses the configured default tracker. Browser events retain its in-memory session and DNT behavior; the bridge also skips Global Privacy Control. Lifecycle callbacks pass the static source pathname to the tracker, so a Calendar management URL does not add its bearer token to the event path. tracker.track(name, properties, path?) accepts that optional pathname without changing existing two-argument calls. Custom tracker implementations must honor that path argument. This protection applies to the new lifecycle bridge; general page-view/custom-event tracking still uses its existing path behavior, so avoid collecting private bearer routes through those APIs. These observations are untrusted and cannot confirm payment. Wire each event on one side to avoid counting both browser and server callbacks.

When Analytics and any supported source are selected in btst init, Codegen wires the corresponding server helpers. Its generated session: () => null keeps collection disabled until you supply your application's consented session resolver. Selecting either plugin alone adds no integration imports or hooks. The tested CLI cohort includes Core 6.1, Analytics 1.1, School 2.0, Feature Flags 1.1, Calendar 1.1, Ecommerce 1.0.1, and CMS 1.1 (required by School's revision-aware writes) for these APIs; prepared package versions do not publish packages automatically.

Prop

Type

Configuration reference

Prop

Type

Prop

Type

Prop

Type

Page-scoped presentation

Set overrides.analytics.pageOverrides.analyticsDashboard.TrafficChart on StackProvider to replace the traffic chart without replacing date filters, metrics, tables, or CSV export. The component receives AnalyticsTrafficChartProps (series, the daily page view and visitor totals), exported from @btst/plugin-analytics/client.

overrides={{
  analytics: {
    pageOverrides: {
      analyticsDashboard: { TrafficChart: ({ series }) => <MyTrafficChart series={series} /> },
    },
  },
}}

Unconfigured charts retain their built-in presentation. analyticsDashboard is the supported route key; pageComponents.dashboard still replaces the whole page. Reusable charts rendered outside the built-in dashboard do not inherit its page scope.