Skip to content

Silo Analytics

@adpharm/silo-analytics is Silo’s browser SDK for sending analytics into the Silo CDP. At its core it’s a thin wrapper around @segment/analytics-next, so it speaks the same Segment-compatible API you already know — track, page, identify, source middleware, plugins. You swap one import; events flow first-party into Silo with sensible defaults.

import { AnalyticsBrowser } from "@adpharm/silo-analytics";
export const analytics = AnalyticsBrowser.load({
writeKey: "your-write-key",
});

Silo needs a first-party collection SDK that teams can adopt without relearning their instrumentation. Rather than invent a new API, this library wraps @segment/analytics-next and keeps it Segment-compatible — existing analytics.track/page/identify calls, middleware, and plugins keep working unchanged. What the wrapper adds is Silo-aware defaults (CDN + event gateway wired automatically) plus a set of built-in tracking plugins that enrich every event, so you get useful data out of the box instead of a blank SDK.

Segment-compatible

A drop-in replacement for @segment/analytics-next. Keep your existing Segment instrumentation, middleware, and plugins — just change the import.

First-party delivery

Events are sent first-party to your Silo event gateway; the CDN and API hosts are wired by default from your writeKey.

SPA-ready

Internal route changes are detected via Segment page events + browser back/forward (popstate); per-view tracking resets cleanly.

Batteries included

Built-in tracking plugins (engagement, scroll depth) auto-register with sensible defaults and ship deterministic, dedup-friendly beacons.

On top of the Segment-compatible base, the SDK auto-registers tracking plugins that enrich what you collect — no wiring required:

  • Time on Page — an idle-aware page-engagement event on every view, with bounce/zombie-tab guardrails and a crash-resilient heartbeat. See Time on Page.
  • Scroll depth — each beacon carries deterministic scroll_depth_max_px plus estimated percentage fields when the page is scrollable. See Scroll Depth.
  • Reliable deliverypagehide + visibilitychange + Safari-only beforeunload; failed beacons persist to localStorage and replay on next load.
  • Server-side dedup — every beacon carries messageId, page_view_id, and sequence so retries collapse cleanly. See Server-Side Dedup.