Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Next-generation, Git-native event collection and routing system. A replacement for Adobe Launch and Google Tag Manager built for the modern web.

License

Notifications You must be signed in to change notification settings

tyssejc/junction

Repository files navigation

Junction

Next-generation, Git-native event collection and routing system. A replacement for Adobe Launch and Google Tag Manager built for the modern web.

Why Junction

Tag managers were designed for marketers adding snippets to websites. Junction is designed for engineers building data infrastructure. Events are the primitive — not tags, not rules. Configuration lives in TypeScript files, reviewed in pull requests, deployed through CI/CD.

Config as code. Your tracking config is a TypeScript file in your repo. No web UI, no race conditions, no "who changed that rule in production?"

Consent-first. Events queue until consent is resolved. Destinations only receive events they're allowed to see. DNT and GPC respected out of the box.

Schema validation. Zod contracts enforce event shapes at runtime. Catch typos, missing fields, and type mismatches before they reach your analytics.

Isomorphic. The same collector runs in browsers, Node.js, Deno, Cloudflare Workers, and Bun. Write once, deploy anywhere.

Packages

Package Description
@junctionjs/core Isomorphic collector, consent state machine, Zod validation
@junctionjs/client Browser runtime — anonymous IDs, sessions, auto page views
@junctionjs/astro Astro v5+ integration — script injection, SSR middleware, View Transitions
@junctionjs/gateway WinterCG edge gateway — Cloudflare Workers, Deno, Bun, Vercel Edge
@junctionjs/destination-amplitude Amplitude (HTTP API, client + server)
@junctionjs/destination-ga4 GA4 (gtag.js, Measurement Protocol, Consent Mode v2)
@junctionjs/destination-meta Meta Pixel + Conversions API
@junctionjs/destination-http Generic HTTP destination — POST events to any endpoint
@junctionjs/destination-plausible Plausible Analytics — privacy-first, consent-exempt
@junctionjs/debug In-page debug panel — real-time event flow visibility

Quick start

npm install @junctionjs/core @junctionjs/client
import { createClient } from "@junctionjs/client";
import { amplitude } from "@junctionjs/destination-amplitude";
const client = createClient({
 name: "my-site",
 environment: "production",
 consent: {
 defaultState: {},
 queueTimeout: 30000,
 respectDNT: true,
 respectGPC: true,
 },
 destinations: [
 {
 destination: amplitude,
 config: { apiKey: "YOUR_KEY", mode: "client" },
 consent: ["analytics"],
 },
 ],
});
// Track events
client.track("product", "viewed", { product_id: "SKU-123", price: 29.99, currency: "USD" });
// Update consent
client.consent({ analytics: true, marketing: false });
// Identify users
client.identify("user-42", { email: "user@example.com" });

Architecture

See docs/ARCHITECTURE.md for the full design document covering data flow, consent semantics, destination plugin interface, and migration paths.

Development

# Install dependencies
npm install
# Build all packages
npm run build
# Run tests
npm test
# Type check
npm run typecheck
# Lint
npm run lint

Writing a destination

Destinations are plain objects with three required methods:

import type { Destination, JctEvent, ConsentState } from "@junctionjs/core";
export const myDestination: Destination<{ apiKey: string }> = {
 name: "my-destination",
 version: "0.1.0",
 consent: ["analytics"],
 runtime: "both",
 init(config) {
 // Load SDKs, validate config
 },
 transform(event: JctEvent) {
 // Convert Junction event to your format. Return null to skip.
 return { name: `${event.entity}_${event.action}`, data: event.properties };
 },
 async send(payload, config) {
 // Send to your service
 await fetch("https://api.example.com/events", {
 method: "POST",
 headers: { "Authorization": `Bearer ${config.apiKey}` },
 body: JSON.stringify(payload),
 });
 },
};

License

MIT

About

Next-generation, Git-native event collection and routing system. A replacement for Adobe Launch and Google Tag Manager built for the modern web.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

AltStyle によって変換されたページ (->オリジナル) /