Releases: mathematic-inc/alyt
v0.1.2
alyt v0.1.2 is here, and we couldn't be more excited to share it! This release brings the full alyt ecosystem up to Node.js 24 LTS with freshly-updated dependencies across every package, while also landing some genuinely great quality-of-life wins: all analytics plugins now accept pre-configured SDK client instances (goodbye, magic globals!), @alyt/codegen ships with richer schema support including JSDoc descriptions, and the whole monorepo builds faster than ever thanks to Turbo. Whether you're wiring up your first analytics provider or scaling across six at once, alyt makes the experience clean, typed, and vendor-agnostic.
✨ New Features
Bring your own SDK client to any plugin
Every analytics plugin now accepts an optional client option so you can pass in an already-initialised SDK instance. This is a huge win for SSR environments, testing, and any setup where you don't want alyt reaching into window globals.
import { createAnalytics } from "@alyt/core";
import { amplitude } from "@alyt/plugin-amplitude";
import * as amplitudeSDK from "@amplitude/analytics-browser";
// Initialise Amplitude however you like, then hand the instance to alyt
await amplitudeSDK.init("YOUR_API_KEY").promise;
const analytics = createAnalytics({
plugins: [
amplitude({ apiKey: "YOUR_API_KEY", client: amplitudeSDK }),
],
});
analytics.track("signed_up", { plan: "pro" });The same client option is available on every plugin: googleAnalytics, mixpanel, amplitude, posthog, plausible, and vercel.
@alyt/codegen — schema descriptions & richer type output
Define your event schema once with human-readable descriptions and let alyt generate a fully-typed tracker. Descriptions now propagate as JSDoc comments in the generated code, making your auto-complete genuinely informative.
analytics.schema.ts
import { generateTracker, generateTypes } from "@alyt/codegen";
import type { Schema } from "@alyt/codegen";
const schema: Schema = {
events: {
signed_up: {
description: "Fired when a user completes registration.",
params: { plan: "string", referral_code: "string" },
},
page_viewed: {
description: "Fired on every client-side navigation.",
params: { path: "string" },
},
},
};
// Generate a type-safe tracker wrapper
console.log(generateTracker(schema));
// Generate matching TypeScript types
console.log(generateTypes(schema));The generated tracker turns raw client.track("signed_up", { plan, referral_code }) calls into properly-typed method calls:
// @generated by @alyt/codegen — do not edit manually
import type { AnalyticsClient, TrackOptions } from "@alyt/core";
export function createTracker(client: AnalyticsClient) {
return {
/** Fired when a user completes registration. */
signedUp(plan: string, referralCode: string, options?: TrackOptions) {
client.track("signed_up", { plan, referral_code: referralCode }, options);
},
/** Fired on every client-side navigation. */
pageViewed(path: string, options?: TrackOptions) {
client.track("page_viewed", { path }, options);
},
};
}⚡ Improvements
Node.js 24 LTS & dependency refresh
The entire monorepo has been bumped to Node.js 24 LTS and all dependencies updated to their latest versions. You get the performance and security improvements of the newest Node.js release with no changes required on your end.
Turbo-powered build orchestration
Package builds are now orchestrated by Turbo, replacing the previous tsc project-references setup. Incremental builds are faster and workspace dependency ordering is handled automatically.
Apache-2.0 license & new home
alyt now lives at mathematic-inc/alyt and is published under the permissive Apache-2.0 licence, making it suitable for use in commercial products with no surprises.
The full API at a glance
@alyt/core
import { createAnalytics } from "@alyt/core";
import { googleAnalytics } from "@alyt/plugin-ga";
import { mixpanel } from "@alyt/plugin-mixpanel";
const analytics = createAnalytics({
plugins: [
googleAnalytics({ measurementId: "G-XXXXXXXX" }),
mixpanel({ token: "YOUR_TOKEN" }),
],
});
// Track an event across all plugins
analytics.track("button_clicked", { label: "Get Started" });
// Track to a specific plugin only
analytics.track("experiment_viewed", { variant: "B" }, { only: ["mixpanel"] });
// Identify a user
analytics.identify("user_123", { email: "jane@example.com" });
// Track a page view
analytics.page("/dashboard");
// Reset (e.g. on sign-out)
analytics.reset();
// Add or remove plugins at runtime
analytics.addPlugin(myCustomPlugin);
analytics.removePlugin("google-analytics");@alyt/react
import { createAnalytics } from "@alyt/core";
import { AnalyticsProvider, useAnalytics } from "@alyt/react";
import { posthog } from "@alyt/plugin-posthog";
const analytics = createAnalytics({
plugins: [posthog({ apiKey: "phc_..." })],
});
// Wrap your app
function App() {
return (
<AnalyticsProvider client={analytics}>
<MyApp />
</AnalyticsProvider>
);
}
// Use anywhere in the tree
function SignupButton() {
const analytics = useAnalytics();
return (
<button onClick={() => analytics.track("signup_clicked")}>
Get started
</button>
);
}Installation
Install the core package plus whichever provider plugins you need:
# Core (required)
npm install @alyt/core
# Provider plugins (pick any)
npm install @alyt/plugin-ga
npm install @alyt/plugin-mixpanel
npm install @alyt/plugin-amplitude
npm install @alyt/plugin-posthog
npm install @alyt/plugin-plausible
npm install @alyt/plugin-vercel
# React bindings
npm install @alyt/react
# Code generation (dev dependency)
npm install --save-dev @alyt/codegenOr with pnpm / yarn:
pnpm add @alyt/core @alyt/plugin-ga @alyt/react
yarn add @alyt/core @alyt/plugin-ga @alyt/reactFull changelog: v0.1.1...v0.1.2
react-v0.1.2
@alyt/react v0.1.2 is here, and it brings the full power of alyt's unified analytics interface straight into your React component tree! This release ships polished React bindings — a dead-simple <AnalyticsProvider> and a crisp useAnalytics() hook — backed by an improved build pipeline, a fresh Apache-2.0 license, and full compatibility with React 18 and 19. Whether you're tracking page views, identifying users, or firing events to six analytics providers simultaneously, @alyt/react makes it feel effortless.
✨ New Features
<AnalyticsProvider> — analytics context for your app
Wrap your app (or any subtree) with <AnalyticsProvider> to inject an AnalyticsClient into the React context. Pass in any client built with createAnalytics() from @alyt/core, loaded up with whichever plugins you need.
import { createAnalytics } from "@alyt/core";
import { createGAPlugin } from "@alyt/plugin-ga";
import { createMixpanelPlugin } from "@alyt/plugin-mixpanel";
import { AnalyticsProvider } from "@alyt/react";
const client = createAnalytics({
plugins: [
createGAPlugin({ measurementId: "G-XXXXXXXXXX" }),
createMixpanelPlugin({ token: "your-mixpanel-token" }),
],
});
export function App() {
return (
<AnalyticsProvider client={client}>
<Router />
</AnalyticsProvider>
);
}useAnalytics() — track events from any component
Grab the analytics client anywhere in the tree with the useAnalytics() hook. The full AnalyticsClient API is at your fingertips: track, identify, page, reset, and dynamic plugin management via addPlugin / removePlugin.
import { useAnalytics } from "@alyt/react";
function SignupButton() {
const analytics = useAnalytics();
function handleClick() {
analytics.track("user_signed_up", { plan: "pro", source: "landing_page" });
}
return <button onClick={handleClick}>Get started</button>;
}Need to target only one provider for a specific event? TrackOptions has you covered:
// Fire this event to Amplitude only
analytics.track("experiment_enrolled", { variant: "B" }, { only: ["amplitude"] });🐛 Bug Fixes
- Fixed build orchestration — switched from
tscproject references to Turborepo for build coordination, resolving incremental build issues across the monorepo. (6f12295)
⚡ Improvements
- Transferred to
mathematic-inc— the repository now lives at mathematic-inc/alyt, with an improved release pipeline and automated publishing via npm trusted publishers (OIDC). (bd7a8be) - Apache-2.0 license — alyt is now explicitly Apache-2.0 licensed, making it enterprise-friendly right out of the box.
- Node.js 24 LTS — CI and tooling now target Node.js 24 LTS, keeping the project on a modern, supported runtime.
📦 Installation
# npm
npm install @alyt/react @alyt/core
# pnpm
pnpm add @alyt/react @alyt/core
# yarn
yarn add @alyt/react @alyt/corePick your analytics providers:
npm install @alyt/plugin-ga # Google Analytics
npm install @alyt/plugin-mixpanel # Mixpanel
npm install @alyt/plugin-amplitude # Amplitude
npm install @alyt/plugin-posthog # PostHog
npm install @alyt/plugin-plausible # Plausible
npm install @alyt/plugin-vercel # Vercel AnalyticsWant fully typed events? Generate a type-safe tracker from your event schema:
npm install -D @alyt/codegen
npx alyt-codegen --schema events.json --out src/analytics.generated.tsFull changelog: react-v0.1.1...react-v0.1.2
plugin-vercel-v0.1.2
@alyt/plugin-vercel v0.1.2 is here, and it's packed with quality-of-life improvements that make integrating Vercel Analytics into your alyt setup more flexible, more testable, and better documented than ever. This release ships injectable SDK client support across every plugin, JSDoc-annotated code generation, three ready-to-run examples, and a shiny new Apache-2.0 license — all backed by Node.js 24 LTS under the hood.
✨ New Features
Inject your own Vercel Analytics client
Every alyt plugin — including @alyt/plugin-vercel — now accepts an optional client in its options. This means you can pass in a pre-configured SDK instance instead of relying on the default window global. It's a game-changer for server-side usage, testing, and custom setups:
import { createAnalytics } from "@alyt/core";
import { vercelAnalytics } from "@alyt/plugin-vercel";
import { track } from "@vercel/analytics/server";
// Use the server-side Vercel track function directly
const analytics = createAnalytics({
plugins: [
vercelAnalytics({ client: { track } }),
],
});
analytics.track("checkout_completed", { plan: "pro" });And in tests, swap it for a mock — no patching globals required:
import { vercelAnalytics } from "@alyt/plugin-vercel";
import { vi, expect, it } from "vitest";
it("tracks events through the injected client", () => {
const mockTrack = vi.fn();
const plugin = vercelAnalytics({ client: { track: mockTrack } });
plugin.track("button_clicked", { label: "Sign Up" });
expect(mockTrack).toHaveBeenCalledWith("button_clicked", { label: "Sign Up" });
});Schema event descriptions → JSDoc comments
The @alyt/codegen code generator now supports an optional description field on schema events. It flows through to JSDoc comments on both the generated AnalyticsEventMap types and the tracker methods — so your IDE gives you inline documentation right where you need it:
# analytics.schema.yaml
events:
checkout_completed:
description: Fired when a user successfully completes checkout.
params:
plan: string
coupon_code: string// @generated by @alyt/codegen — do not edit manually
export interface AnalyticsEventMap {
/** Fired when a user successfully completes checkout. */
checkout_completed: { plan: string; coupon_code: string };
}⚡ Improvements
Three example projects
Not sure how to wire everything together? The repo now ships three complete, ready-to-run examples:
examples/basic/— Vanilla TypeScript with multiple plugins in a few linesexamples/nextjs/— Next.js App Router + codegen, with pre-generated types verified against the CLIexamples/custom-plugin/— Build and register your ownAnalyticsPluginfrom scratch
Node.js 24 LTS & fresh dependencies
The entire workspace has been updated to Node.js 24 LTS with all dependencies refreshed to their latest versions — including @vercel/analytics ^2.0.0, react 19.2.4, and vitest ^4.0.18. You're on solid, modern ground.
Apache-2.0 license & new home
alyt has moved to mathematic-inc and is now published under the Apache-2.0 license. Permissive, enterprise-friendly, and ready for production.
📦 Installation
# npm
npm install @alyt/plugin-vercel @alyt/core
# pnpm
pnpm add @alyt/plugin-vercel @alyt/core
# yarn
yarn add @alyt/plugin-vercel @alyt/coreFor React support:
npm install @alyt/reactFor typed event codegen:
npm install --save-dev @alyt/codegen
npx alyt-codegen --schema analytics.schema.yaml --out lib/generatedFull changelog:
890b266...17608f3
plugin-posthog-v0.1.2
@alyt/plugin-posthog v0.1.2 is here, and it brings the full power of PostHog into the alyt unified analytics ecosystem — with a clean TypeScript API, first-class React/Next.js support, and a brand-new ability to inject your own PostHog client instance for maximum flexibility. Whether you're tracking events in a browser app, server-side rendering with Next.js, or wiring up a test suite, this release has you covered.
✨ New Features
Bring Your Own PostHog Client
You no longer have to rely on the window.posthog global. Pass your own initialized PostHog client directly to the plugin — perfect for custom initialization, SSR scenarios, or unit tests where you want full control.
import posthogJs from "posthog-js";
import { createAnalytics } from "@alyt/core";
import { posthog } from "@alyt/plugin-posthog";
// Initialize PostHog yourself
posthogJs.init("phc_your_api_key", { api_host: "https://us.i.posthog.com" });
const analytics = createAnalytics({
plugins: [
posthog({
apiKey: "phc_your_api_key",
client: posthogJs, // 👈 injected directly — no window.posthog dependency
}),
],
});
analytics.track("signed_up", { plan: "pro" });This also makes testing a breeze — just pass a mock client and assert against it:
import { posthog } from "@alyt/plugin-posthog";
import { vi, expect } from "vitest";
const client = { capture: vi.fn(), identify: vi.fn(), reset: vi.fn() };
const plugin = posthog({ apiKey: "phc_test", client: client as never });
plugin.track("button_clicked", { label: "Get Started" });
expect(client.capture).toHaveBeenCalledWith("button_clicked", { label: "Get Started" });Next.js <PostHogScript /> Component
Drop PostHog into your Next.js app with a single component — no manual script tags, no inline boilerplate. It uses Next.js's <Script> with strategy="afterInteractive" for optimized loading.
import { PostHogScript } from "@alyt/plugin-posthog/react";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
<PostHogScript apiKey="phc_your_api_key" />
{children}
</body>
</html>
);
}Full Plugin API Coverage
The PostHog plugin implements the complete alyt AnalyticsPlugin interface:
import { createAnalytics } from "@alyt/core";
import { posthog } from "@alyt/plugin-posthog";
const analytics = createAnalytics({
plugins: [posthog({ apiKey: "phc_your_api_key" })],
});
// Track a custom event
analytics.track("video_played", { title: "Intro to alyt", duration: 120 });
// Identify a user with traits
analytics.identify("user-42", { email: "jane@example.com", plan: "pro" });
// Record a pageview
analytics.page("Pricing", { path: "/pricing" });
// Reset on logout
analytics.reset();⚡ Improvements
- Apache-2.0 license — the entire alyt project, including this plugin, is now published under the permissive Apache-2.0 license. Use it freely in commercial and open-source projects alike.
- Node.js 24 LTS — the project now targets Node 24 LTS, keeping you on the modern, supported runtime.
- Turborepo build orchestration — builds are now managed by Turbo for faster, more reliable incremental compilation across the monorepo.
📦 Installation
# npm
npm install @alyt/core @alyt/plugin-posthog
# pnpm
pnpm add @alyt/core @alyt/plugin-posthog
# yarn
yarn add @alyt/core @alyt/plugin-posthogPeer dependencies:
posthog-js >= 1is optional (only needed if you're not injecting your own client). For the React subpath,react >= 18andnext >= 14are also optional peer dependencies.
// Core plugin
import { posthog } from "@alyt/plugin-posthog";
// React / Next.js script component
import { PostHogScript } from "@alyt/plugin-posthog/react";plugin-plausible-v0.1.2
@alyt/plugin-plausible v0.1.2 🎉
Privacy-first analytics just got a whole lot easier. The inaugural release of @alyt/plugin-plausible brings Plausible Analytics into alyt's unified event-tracking interface — so you can track events with full type safety, swap providers without rewriting your calls, and keep your users' data where it belongs: off surveillance networks.
✨ New Features
Plausible plugin for alyt
Drop-in Plausible Analytics support through alyt's createAnalytics API. One call to plausible() and you're tracking events with the same interface you use for every other provider.
import { createAnalytics } from "@alyt/core";
import { plausible } from "@alyt/plugin-plausible";
const analytics = createAnalytics({
plugins: [
plausible({ domain: "example.com" }),
],
});
// Track any event — forwarded to window.plausible automatically
analytics.track("signup", { plan: "pro" });Self-hosted Plausible support via apiHost
Running your own Plausible instance? Pass apiHost and the script loads from your server — zero configuration headaches.
plausible({
domain: "example.com",
apiHost: "https://analytics.example.com",
});Bring-your-own client for testing & SSR
Inject a custom client function to replace the window.plausible global. Perfect for unit tests, server-side rendering environments, or custom Plausible wrappers.
import { plausible } from "@alyt/plugin-plausible";
// In tests — no window needed
const plugin = plausible({
domain: "example.com",
client: (event, options) => {
console.log("Track:", event, options?.props);
},
});
plugin.track("button_click", { label: "hero-cta" });
// → Track: button_click { label: 'hero-cta' }PlausibleScript React component for Next.js
A ready-made Next.js <Script> wrapper that loads the Plausible tracker with the right strategy, defer, and data-domain attributes — no copy-pasting script tags.
import { PlausibleScript } from "@alyt/plugin-plausible/react";
// In your root layout or _app.tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
<PlausibleScript domain="example.com" />
{children}
</body>
</html>
);
}Works with self-hosted Plausible too:
<PlausibleScript domain="example.com" apiHost="https://analytics.example.com" />Graceful no-op when Plausible isn't loaded
If window.plausible isn't available (e.g. an ad blocker, SSR, or a test environment without a custom client), the plugin silently does nothing — no thrown errors, no crashes.
Installation
npm install @alyt/plugin-plausible
# or
pnpm add @alyt/plugin-plausible
# or
yarn add @alyt/plugin-plausibleIf you're not already using the alyt core:
npm install @alyt/core @alyt/plugin-plausibleFor the React/Next.js component (PlausibleScript), peer dependencies react >= 18 and next >= 14 are required but optional — install them only if you're using the /react sub-path export.
Released under the Apache-2.0 License by Mathematic Inc.
plugin-mixpanel-v0.1.2
@alyt/plugin-mixpanel v0.1.2 is here — and it brings a fully-featured, type-safe Mixpanel integration into the alyt analytics ecosystem! This release ships the complete Mixpanel plugin with event tracking, user identification, page views, and session resets, plus a slick React/Next.js script component and first-class support for injecting your own typed Mixpanel client. Whether you're dropping Mixpanel into a new project or migrating an existing one, this plugin has you covered end-to-end.
✨ New Features
Complete Mixpanel Plugin
The mixpanel() factory function returns a fully-wired AnalyticsPlugin implementing all four lifecycle methods: track, identify, page, and reset. Pass it to createAnalytics alongside any other plugins and alyt routes your calls automatically.
import { createAnalytics } from "@alyt/core";
import { mixpanel } from "@alyt/plugin-mixpanel";
const analytics = createAnalytics({
plugins: [mixpanel({ token: "YOUR_MIXPANEL_TOKEN" })],
});
// Track events with arbitrary properties
analytics.track("signup_completed", { plan: "pro", source: "landing_page" });
// Identify users and set People properties in one call
analytics.identify("user_42", { email: "ada@example.com", name: "Ada" });
// Track page views
analytics.page("Dashboard", { section: "analytics" });
// Reset on logout
analytics.reset();Typed SDK Client Injection
Bring your own OverridedMixpanel instance — ideal for server-side rendering, testing, or advanced multi-instance setups. When a client is provided, the plugin uses it directly instead of falling back to window.mixpanel.
import mixpanelBrowser from "mixpanel-browser";
import { mixpanel } from "@alyt/plugin-mixpanel";
mixpanelBrowser.init("YOUR_MIXPANEL_TOKEN");
const analytics = createAnalytics({
plugins: [
mixpanel({
token: "YOUR_MIXPANEL_TOKEN",
client: mixpanelBrowser, // fully typed as OverridedMixpanel
}),
],
});React / Next.js MixpanelScript Component
Drop Mixpanel into your Next.js app in one line. MixpanelScript injects the official Mixpanel snippet using Next.js's Script component with the afterInteractive strategy, so it never blocks your page render.
import { MixpanelScript } from "@alyt/plugin-mixpanel/react";
// In your app/layout.tsx or _app.tsx:
export default function RootLayout({ children }) {
return (
<html>
<body>
<MixpanelScript token="YOUR_MIXPANEL_TOKEN" />
{children}
</body>
</html>
);
}Graceful No-Op When Mixpanel Isn't Ready
The plugin safely skips all calls when window.mixpanel is not yet available, so you never have to guard your tracking calls or worry about initialization order.
🐛 Bug Fixes
- Build orchestration via Turbo — switched from
tscproject references to Turbo for build orchestration, resulting in faster, more reliable builds across the monorepo.
⚡ Improvements
- Node.js 24 LTS — the project now runs on the latest Node.js 24 LTS, with all dependencies updated to their latest versions.
- Apache-2.0 license —
@alyt/plugin-mixpanelis now published under the permissive Apache-2.0 license and maintained under mathematic-inc. - Typed
mixpanel-browserpeer dependency — the plugin declaresmixpanel-browser >= 2as an optional peer dependency and uses its types directly, giving you full autocomplete on theclientoption.
📦 Installation
npm install @alyt/plugin-mixpanel
# or
pnpm add @alyt/plugin-mixpanel
# or
yarn add @alyt/plugin-mixpanelYou'll also need the core package if you haven't installed it yet:
npm install @alyt/coreFor React/Next.js support, react >= 18 and next >= 14 are optional peer dependencies — install them as needed for your project.
For typed client injection, install the mixpanel-browser peer dependency:
npm install mixpanel-browserplugin-ga-v0.1.2
@alyt/plugin-ga v0.1.2
We're thrilled to ship @alyt/plugin-ga v0.1.2 — a polished, production-ready Google Analytics (gtag.js) plugin for the alyt analytics SDK! This release brings first-class support for injecting your own gtag client instance (perfect for testing and SSR), a zero-config <GAScript> component for Next.js that handles all the script loading boilerplate for you, and a switch to Turbo-powered builds for faster, more reliable compilation. The project has also moved to a new home under mathematic-inc with an Apache-2.0 license, setting the stage for open, long-term development.
✨ New Features
Inject a custom gtag client instance
No more fighting window.gtag in tests or server-side environments. Pass your own client directly to googleAnalytics() and keep full control:
import { createAnalytics } from "@alyt/core";
import { googleAnalytics } from "@alyt/plugin-ga";
// In tests — pass a mock instead of relying on window.gtag
const mockGtag = vi.fn();
const analytics = createAnalytics({
plugins: [
googleAnalytics({
measurementId: "G-XXXXXXXXXX",
client: mockGtag,
}),
],
});
analytics.track("sign_up", { plan: "pro" });
// mockGtag called with ("event", "sign_up", { plan: "pro" })When client is omitted the plugin falls back to window.gtag as usual, so existing setups need zero changes.
<GAScript> — drop-in Next.js script loader
Stop copy-pasting gtag bootstrap snippets into every project. Import GAScript from the /react subpath and it handles everything — loading the gtag library, initialising the data layer, and configuring your Measurement ID — all with Next.js's afterInteractive strategy:
import { GAScript } from "@alyt/plugin-ga/react";
// In your root layout (Next.js App Router):
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
<GAScript measurementId="G-XXXXXXXXXX" />
{children}
</body>
</html>
);
}measurementId is optional — if omitted, GAScript reads NEXT_PUBLIC_GA_MEASUREMENT_ID from your environment automatically. No ID, no script — nothing is injected.
Full track / identify / page / reset support
The plugin covers the complete alyt plugin interface:
const analytics = createAnalytics({
plugins: [googleAnalytics({ measurementId: "G-XXXXXXXXXX" })],
});
// Track custom events
analytics.track("button_clicked", { label: "Sign Up", location: "hero" });
// Identify users
analytics.identify("user_123", { plan: "pro", email: "ada@example.com" });
// Page views
analytics.page("Pricing");
// Reset on sign-out
analytics.reset();🐛 Bug Fixes
- Turbo build orchestration — switched from
tscproject references to Turbo for build orchestration, fixing intermittent build ordering issues in monorepo setups. (6f12295)
⚡ Improvements
- Apache-2.0 license — the project is now officially open source under Apache-2.0, giving you clear IP terms for commercial use.
- Node.js 24 LTS — the entire alyt monorepo is now tested and built on Node.js 24 LTS, keeping you on a well-supported, modern runtime.
- Repository moved to
mathematic-inc— the canonical home is now github.com/mathematic-inc/alyt with an improved CI/CD release pipeline.
Installation
# npm
npm install @alyt/plugin-ga @alyt/core
# pnpm
pnpm add @alyt/plugin-ga @alyt/core
# yarn
yarn add @alyt/plugin-ga @alyt/coreFor the React/Next.js <GAScript> component, React 18+ and Next.js 14+ are supported as optional peer dependencies — install them if you haven't already:
npm install react nextFull suite — pick the providers you need:
npm install @alyt/core \
@alyt/plugin-ga \
@alyt/plugin-posthog \
@alyt/plugin-mixpanel \
@alyt/plugin-amplitude \
@alyt/plugin-plausible \
@alyt/plugin-vercel \
@alyt/reactFull Changelog: plugin-ga-v0.1.1...plugin-ga-v0.1.2
plugin-amplitude-v0.1.2
@alyt/plugin-amplitude v0.1.2 🎉
We're thrilled to ship the first stable release of @alyt/plugin-amplitude — the official Amplitude plugin for alyt, the TypeScript analytics library that gives you a single, unified interface for tracking events across every major analytics provider. Drop it in, wire up your plugins, and never think about vendor-specific APIs again. This release brings full Amplitude Browser SDK support, rock-solid SSR safety, and the ability to inject your own SDK client instance for maximum flexibility in testing and server-rendered apps.
✨ New Features
Amplitude plugin for alyt
The amplitude() plugin bridges alyt's unified AnalyticsClient API to the Amplitude Browser SDK. It handles track, identify, page, and reset — everything you need to get your Amplitude instrumentation running in minutes.
import { createAnalytics } from "@alyt/core";
import { amplitude } from "@alyt/plugin-amplitude";
const analytics = createAnalytics({
plugins: [
amplitude({ apiKey: "YOUR_AMPLITUDE_API_KEY" }),
],
});
// Track an event
analytics.track("button_clicked", { label: "Sign Up" });
// Identify a user
analytics.identify("user_42", { plan: "pro" });
// Track a page view
analytics.page("Pricing", { url: "/pricing" });
// Reset on logout
analytics.reset();Bring-your-own SDK client
Don't want to rely on window.amplitude? Pass your own initialized AmplitudeBrowser client directly — perfect for testing, SSR setups, or advanced configurations where you control the SDK lifecycle.
import * as amplitudeSDK from "@amplitude/analytics-browser";
import { amplitude } from "@alyt/plugin-amplitude";
await amplitudeSDK.init("YOUR_API_KEY").promise;
const analytics = createAnalytics({
plugins: [
amplitude({ apiKey: "YOUR_API_KEY", client: amplitudeSDK }),
],
});SSR-safe by default
The plugin gracefully no-ops when window.amplitude is not present — no crashes during server-side rendering or in test environments where the global isn't defined.
Page view tracking
analytics.page() maps to Amplitude's "Page View" event, forwarding page_title and any extra params — consistent with Amplitude's recommended page-view schema.
analytics.page("Home", { referrer: "google.com" });
// Amplitude receives: { event: "Page View", page_title: "Home", referrer: "google.com" }Selective plugin targeting
Use alyt's TrackOptions to send an event to Amplitude only — handy when you want to route specific events to a single destination without touching the rest of your plugin stack.
analytics.track("amplitude_only_event", { foo: "bar" }, { only: ["amplitude"] });⚡ Improvements
- Node.js 24 LTS — the full alyt monorepo now targets Node.js 24, keeping you on the latest LTS for better performance and long-term support.
- Updated dependencies —
@amplitude/analytics-browserpeer dep bumped to>=2,reactpeer dep updated to>=18, and all dev dependencies refreshed to their latest versions. - Apache-2.0 license — alyt and all its packages are now published under the Apache-2.0 license, making it clear and business-friendly for everyone.
- Turbo-powered builds — the build pipeline now uses Turbo for fast, correct build orchestration across the monorepo.
📦 Installation
Install the Amplitude plugin alongside the alyt core:
npm install @alyt/core @alyt/plugin-amplitudepnpm add @alyt/core @alyt/plugin-amplitudeyarn add @alyt/core @alyt/plugin-amplitudeYou'll also need the Amplitude Browser SDK as a peer dependency:
npm install @amplitude/analytics-browserReact users:
@alyt/reactprovides anAnalyticsProvideranduseAnalyticshook to plug the unified client directly into your component tree.npm install @alyt/react
Happy tracking! If you run into anything, please open an issue. ⚡
codegen-v0.1.2
@alyt/codegen v0.1.2
We're thrilled to ship @alyt/codegen v0.1.2 — a YAML-powered TypeScript code generator that turns your analytics event schema into a fully-typed tracker and event map with zero runtime overhead. This release polishes the entire alyt ecosystem: plugins now accept injected SDK clients (goodbye window globals!), JSDoc descriptions flow straight from your YAML schema into generated code, and the project has a new home under mathematic-inc with an Apache-2.0 license and a hardened, supply-chain-secure CI pipeline. Whether you're wiring up a Next.js app or building a custom plugin, alyt makes analytics feel like a first-class part of your codebase.
✨ New Features
Schema description support → JSDoc in generated code
Events in your YAML schema can now carry an optional description field. @alyt/codegen picks it up and emits JSDoc comments in both the generated AnalyticsEventMap interface and every tracker method — so your IDE's autocomplete is as informative as your schema.
analytics.schema.yaml
events:
button_clicked:
description: Fired when a user clicks a button
params:
button_id: string
label: string
user_signed_up:
description: Fired when a new user completes registrationGenerated tracker.ts (via alyt-codegen --schema analytics.schema.yaml --out lib/generated)
// @generated by @alyt/codegen — do not edit manually
import type { AnalyticsClient, TrackOptions } from "@alyt/core";
export function createTracker(client: AnalyticsClient) {
return {
/** Fired when a user clicks a button */
buttonClicked(buttonId: string, label: string, options?: TrackOptions) {
client.track("button_clicked", { button_id: buttonId, label: label }, options);
},
/** Fired when a new user completes registration */
userSignedUp(options?: TrackOptions) {
client.track("user_signed_up", undefined, options);
},
};
}Plugin SDK client injection
All six provider plugins now accept an optional client in their options object, typed against the real SDK types (AmplitudeBrowser, posthog, Mixpanel, etc.). This means you can inject an already-initialised SDK instance directly — no more depending on window globals, making SSR, testing, and tree-shaking significantly cleaner.
import { amplitude } from "@alyt/plugin-amplitude";
import * as amplitudeJs from "@amplitude/analytics-browser";
amplitudeJs.init("YOUR_API_KEY");
const analytics = createAnalytics({
plugins: [
amplitude({ apiKey: "YOUR_API_KEY", client: amplitudeJs }),
],
});When client is omitted, plugins fall back gracefully to the window global — so existing setups keep working without changes.
Dynamic plugin management
@alyt/core now exposes addPlugin and removePlugin on AnalyticsClient, letting you compose your analytics pipeline at runtime:
import { createAnalytics } from "@alyt/core";
import { posthog } from "@alyt/plugin-posthog";
const analytics = createAnalytics();
// Add PostHog after user consents to tracking
analytics.addPlugin(posthog({ apiKey: "phc_..." }));
// Remove it if they later opt out
analytics.removePlugin("posthog");⚡ Improvements
- Apache-2.0 license — The project has moved from MIT to Apache-2.0 across all packages, providing clearer patent grants for enterprise users.
- Node.js 24 LTS — The entire monorepo now targets Node.js 24 LTS; all dependencies have been updated to their latest versions.
- Turbo build orchestration — Replaced
tscproject references with Turborepo for faster, correctly-ordered builds across the monorepo. - Hardened CI pipeline — All GitHub Actions are now pinned to commit hashes for supply-chain security. The release workflow correctly handles both umbrella (
v*) and per-package (codegen-v*,react-v*, …) tags. - Linting & formatting —
biome+lefthookpre-commit hooks keep the codebase consistently formatted. - README & examples — A comprehensive root README and three ready-to-run examples land in this release:
examples/basic— vanilla TypeScript setupexamples/nextjs— Next.js App Router with codegenexamples/custom-plugin— building your own provider plugin
🐛 Bug Fixes
- Fixed build ordering issue where
tscproject references caused incorrect incremental builds; Turborepo now handles dependency-aware orchestration correctly. - Fixed the release workflow so that component-prefixed tags (
plugin-ga-v*, etc.) correctly trigger per-package publish jobs.
📦 Installation
# Core client (required)
npm install @alyt/core
# Code generator CLI (dev dependency)
npm install --save-dev @alyt/codegen
# React bindings
npm install @alyt/react
# Provider plugins — pick the ones you need
npm install @alyt/plugin-amplitude
npm install @alyt/plugin-ga
npm install @alyt/plugin-mixpanel
npm install @alyt/plugin-plausible
npm install @alyt/plugin-posthog
npm install @alyt/plugin-vercelOr with other package managers:
pnpm add @alyt/core @alyt/codegen
yarn add @alyt/core && yarn add --dev @alyt/codegenFull changelog: codegen-v0.1.1...codegen-v0.1.2