← Til baka

Build a Link Shortener with Analytics: API Guide + Self-Host Alternative

· 5 mín lestrartími · Almennt

Why Bitly Isn't Enough Anymore

Bitly changed their pricing in 2024. The free tier went from unlimited to 10 links per month. TinyURL has no analytics. Most alternatives are either expensive ($29+/month) or shut down. If you need a URL shortener for your app, you need a better option.

What You Actually Need

For most developers and small businesses, the requirements are simple:

Pandan Link Shortener

We built s.pandan.is to solve exactly this. It's a link shortener with built-in analytics, a free tier, and a simple API.

Create a Short Link

curl -X POST https://s.pandan.is/api/shorten \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://example.com/very-long-article-about-something"}'

Response:

{
  "short": "https://s.pandan.is/abc123",
  "slug": "abc123",
  "original": "https://example.com/very-long-article-about-something"
}

Custom Slugs

curl -X POST https://s.pandan.is/api/shorten \
  -d '{"url": "https://mysite.com", "slug": "my-brand"}'

Now s.pandan.is/my-brand redirects to your URL.

Click Analytics

GET https://s.pandan.is/api/stats/abc123

{
  "slug": "abc123",
  "clicks": 1247,
  "created": "2026-03-20T10:00:00Z",
  "recent": [
    { "timestamp": "...", "referrer": "twitter.com", "country": "US" },
    ...
  ]
}

Use Cases

Marketing Campaigns

Create unique short links for each campaign channel (email, social, ads) and track which converts best.

SaaS Share Links

Generate short links for user-shared content with built-in analytics to measure virality.

QR Code + Short Link Combo

Combine with a QR code API for print materials:

# 1. Shorten the URL
SHORT=$(curl -s -X POST https://s.pandan.is/api/shorten \
  -d '{"url": "https://mysite.com/promo"}' | jq -r .short)

# 2. Generate QR code for the short URL
curl "https://qr.pandan.is/v1/qr?data=$SHORT&size=400" -o promo-qr.png

Pricing

PlanPriceLinksAnalytics
Free$050/monthBasic
Starter$5/mo1,000/monthFull
Unlimited$19/moUnlimitedFull + Export

Bitly vs Pandan vs Self-Hosted

BitlyPandanSelf-Hosted
Free links/mo1050Unlimited
Paid from$8/mo$5/mo$5/mo (server)
Custom domainPaid onlyComing soonYes
AnalyticsYesYesDIY
Setup time0 min0 min1-2 hours

For most use cases, an API is the fastest path. Try s.pandan.is — 50 free links, no signup required.