A marketer told me: 'I was using Bitly for link tracking. Then they raised prices to $35/month for basic analytics. Dub.co does the same thing better — with a free tier and an open-source option.'
What Dub.co Offers for Free
Dub.co free tier:
- 25 links/month with analytics
- Custom domains — use your own domain
- Link analytics — clicks, locations, devices, referrers
- QR codes — auto-generated for every link
- Tags — organize links into campaigns
- REST API — full programmatic access
- Open source — self-host for unlimited
Quick Start
# Create a short link
curl -X POST 'https://api.dub.co/links' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://dev.to/scrapingservice/algolia-has-a-free-api",
"domain": "dub.sh",
"key": "algolia-api",
"tagIds": ["clx1234"]
}'
# Returns: https://dub.sh/algolia-api
REST API
# List links
curl 'https://api.dub.co/links?projectSlug=my-project' \
-H 'Authorization: Bearer YOUR_API_KEY'
# Get link analytics
curl 'https://api.dub.co/analytics?linkId=LINK_ID&event=clicks&interval=30d' \
-H 'Authorization: Bearer YOUR_API_KEY'
# Get clicks by country
curl 'https://api.dub.co/analytics?linkId=LINK_ID&event=clicks&groupBy=country' \
-H 'Authorization: Bearer YOUR_API_KEY'
# Update a link
curl -X PATCH 'https://api.dub.co/links/LINK_ID' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"url": "https://new-destination.com"}'
# Delete a link
curl -X DELETE 'https://api.dub.co/links/LINK_ID' \
-H 'Authorization: Bearer YOUR_API_KEY'
Node.js SDK
import { Dub } from 'dub';
const dub = new Dub({ token: process.env.DUB_API_KEY });
// Create a link
const link = await dub.links.create({
url: 'https://yoursite.com/pricing',
domain: 'dub.sh',
key: 'pricing',
externalId: 'campaign-q1-2026',
tagIds: ['marketing', 'q1']
});
console.log(link.shortLink); // https://dub.sh/pricing
// Get analytics
const clicks = await dub.analytics.retrieve({
linkId: link.id,
event: 'clicks',
interval: '30d'
});
// Bulk create links
const links = await dub.links.createMany([
{ url: 'https://yoursite.com/feature-a', key: 'feature-a' },
{ url: 'https://yoursite.com/feature-b', key: 'feature-b' },
{ url: 'https://yoursite.com/feature-c', key: 'feature-c' }
]);
UTM Builder
// Create links with UTM parameters
const campaignLink = await dub.links.create({
url: 'https://yoursite.com/signup',
domain: 'dub.sh',
key: 'spring-sale',
utm_source: 'twitter',
utm_medium: 'social',
utm_campaign: 'spring-2026',
utm_content: 'cta-button'
});
// Resolves to: https://yoursite.com/signup?utm_source=twitter&utm_medium=social&...
Webhooks
app.post('/webhooks/dub', (req, res) => {
const { event, data } = req.body;
if (event === 'link.clicked') {
console.log(`${data.link.shortLink} clicked from ${data.click.country}`);
}
res.sendStatus(200);
});
Self-Hosted (Unlimited)
git clone https://github.com/dubinc/dub.git
cd dub
pnpm install
pnpm dev
Need to track links in your scraping projects? Check out my web scraping actors on Apify.
Need link analytics for your marketing? Email me at spinov001@gmail.com.
Top comments (0)