Ana Sayfa / Kod ve Scriptler / Shortlink A/B Links and Attribution

Shortlink A/B Links and Attribution

Ağırlıklı A/B yönlendirme, UTM atfı, QR kodları ve tıklama analitiğiyle kısa bağlantılar oluşturun.

  • Yayın tarihi10 Kasım 2026
  • Paket içeriği.css, .html, .ts, .tsx, .json, JavaScript .js
  • Son güncelleme10 Kasım 2026
  • Canlı demoVar
Shortlink A/B Links and Attribution

Overview

Every click leaves a trail.

Shortlink is a self-hosted URL router with weighted A/B destinations and first-touch UTM attribution. The console, the redirector and the analytics live in one Express process with one JSON file.

What you get

  • Weighted A/B routing — up to four destinations per link, stable assignment per visitor
  • First-touch UTM chain — stored on each click, appended to the destination, capped at five touches
  • Click log analytics in one request: 7-day buckets, referrers, devices, countries, campaigns, unique visitors
  • Expiry, click cap, password gate and pause, each with a distinct response
  • Dependency-free QR encoder — versions 1–10, Reed–Solomon ECC, downloadable SVG
  • Atomic JSON storage; no database, cache or external analytics
  • Dockerfile and docker-compose included; 87 tests

Why A/B plus attribution

A short link is the one place every campaign passes through. Shortlink uses that position: it splits traffic across weighted destinations and records which campaign, referrer and device produced the click. A returning visitor keeps the same variant, and the UTM chain is replayed onto later direct visits, so the original campaign is not lost.

Stack

Express 4 + React 18 + TypeScript + Vite 6, one atomic JSON store. The QR encoder is written in the project, not imported.

Run it

docker compose up -d --build
# http://localhost:30400

Or locally: npm ci && npm run build && PORT=30400 npm start.

API

GET /api/health · GET/POST /api/links · PATCH/DELETE /api/links/:id · GET /api/links/:id/stats · GET /api/overview · GET /:slug (302)

Features

Per-link weighted A/B split, deterministic per visitor and overridable with ?v=A First-touch UTM chain stored on every redirect; inbound values win Expiry, click cap, password gate and pause switch with distinct responses Dependency-free QR encoder; downloads a standalone SVG Analytics from the click log: 7-day buckets, referrers, devices, countries, UTM One JSON file, atomic writes; 87 tests; Docker included

Requirements

Node.js 20+ (22 recommended) or Docker 24+. No database or external services. A writable data/ directory. A public hostname for short links.