Skip to main content

Overview

Dub provides powerful link management capabilities to help you create, organize, and track your short links. From simple URL shortening to advanced features like custom domains, UTM parameters, and device targeting, Dub gives you complete control over your links. Create a short link through the Dub dashboard or API:
1

Navigate to Links

Click on “Links” in the sidebar to access your links dashboard.
2

Click Create Link

Click the “Create Link” button in the top right corner.
3

Enter Destination URL

Paste the long URL you want to shorten in the “Destination URL” field.
4

Customize Short Link

Optionally customize the short link slug or let Dub generate a random one.
5

Save

Click “Create” to save your short link.
Every link in Dub has the following core properties:

Domain

The short domain for your link (e.g., dub.sh, dub.co, or your custom domain)

Key

The unique slug that identifies your link (e.g., /github)

Destination URL

The long URL where users are redirected when clicking your short link

Short Link

The complete short link combining domain and key (e.g., dub.sh/github)

UTM Parameters

Automatically append UTM parameters to your destination URLs for campaign tracking:
// Example: Creating a link with UTM parameters
const link = {
  domain: "dub.sh",
  key: "summer-sale",
  url: "https://example.com/products",
  utm_source: "twitter",
  utm_medium: "social",
  utm_campaign: "summer_sale",
  utm_term: "shoes",
  utm_content: "banner_ad"
};
The link schema supports these UTM fields:
  • utm_source - The referrer (e.g., google, newsletter)
  • utm_medium - Marketing medium (e.g., cpc, email, social)
  • utm_campaign - Campaign name (e.g., summer_sale)
  • utm_term - Paid keywords
  • utm_content - Differentiate similar content

Device Targeting

Redirect users to different URLs based on their device:
  1. Open the link editor
  2. Scroll to “Device Targeting”
  3. Enable iOS and/or Android targeting
  4. Enter the specific URLs for each platform
Device targeting is available on Pro plans and above. Users on desktop will be redirected to the default URL.

Geographic Targeting

Redirect users to different URLs based on their location:
// Example: Geographic targeting by country
const link = {
  domain: "dub.sh",
  key: "store",
  url: "https://example.com", // Default URL
  geo: {
    "US": "https://example.com/us",
    "GB": "https://example.com/uk",
    "DE": "https://example.com/de"
  }
};
Use 2-letter ISO 3166-1 country codes for geographic targeting. Set an expiration date and optional expired URL:
  1. Open the link editor
  2. Find “Link Expiration”
  3. Set the expiration date and time
  4. Optionally set an “Expired URL” to redirect users after expiration

Password Protection

Protect your links with a password:
const link = {
  domain: "dub.sh",
  key: "private",
  url: "https://example.com/private",
  password: "secure123"
};
Store passwords securely. Once set, passwords cannot be retrieved, only updated.

Folders

Organize your links into folders for better management:
1

Create a Folder

Click “New Folder” in the links dashboard sidebar.
2

Name Your Folder

Give your folder a descriptive name (e.g., “Marketing Campaigns”).
3

Add Links

Move links to folders by selecting them and choosing “Move to Folder”.
Folder properties from the schema:
  • Supports nested organization
  • Each link can belong to one folder
  • Folders can be archived or deleted

Tags

Tag links for flexible categorization:
// Example: Creating a link with tags
const link = {
  domain: "dub.sh",
  key: "blog-post",
  url: "https://example.com/blog/post",
  tagNames: ["blog", "content", "marketing"]
};
Unlike folders, links can have multiple tags, making them ideal for cross-categorization.

Bulk Operations

Bulk Edit

Update multiple links at once:
  1. Select multiple links using checkboxes
  2. Click “Bulk Edit” in the toolbar
  3. Choose properties to update (tags, folder, archived status, etc.)
  4. Apply changes to all selected links

Bulk Delete

Delete multiple links efficiently:
// API Example: Bulk delete
const response = await fetch('/api/links/bulk?workspaceId=ws_123', {
  method: 'DELETE',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    linkIds: ['link_abc', 'link_def', 'link_ghi']
  })
});
Bulk delete operations are permanent and cannot be undone. Consider archiving links instead.
Archive links to hide them from your main view without deleting:
  • Archived links remain accessible via their short URLs
  • Analytics data is preserved
  • Can be unarchived at any time
  • Doesn’t count toward your link limit
Temporarily disable links:
const link = {
  domain: "dub.sh",
  key: "temp",
  url: "https://example.com",
  disabledAt: new Date().toISOString()
};
Disabled links return a 404 when accessed.

Custom OG Tags

Customize social media previews with proxy mode:
  1. Enable “Proxy” in the link editor
  2. Add a custom title (up to 120 characters)
  3. Add a description (up to 240 characters)
  4. Upload or provide an image URL

Comments

Add internal notes to links:
const link = {
  domain: "dub.sh",
  key: "campaign",
  url: "https://example.com/campaign",
  comments: "Q1 2024 marketing campaign - expires end of March"
};
Comments are internal-only and not visible to end users. Each link tracks comprehensive statistics:
  • clicks - Total number of clicks
  • leads - Number of leads generated
  • conversions - Number of conversions
  • sales - Total sales count
  • saleAmount - Revenue in cents
  • lastClicked - Timestamp of most recent click
Statistics are updated in real-time and can be viewed in the analytics dashboard or retrieved via API.

External IDs and Multi-Tenancy

External IDs

Map links to your own database:
const link = {
  domain: "dub.sh",
  key: "customer-portal",
  url: "https://example.com/portal",
  externalId: "ext_customer_12345"
};

Tenant IDs

Support multi-tenant applications:
const link = {
  domain: "dub.sh",
  key: "client-link",
  url: "https://example.com",
  tenantId: "tenant_acme_corp"
};
External IDs must be unique per workspace. Use them to maintain references between Dub links and your application’s data.

API Reference

For detailed API documentation on link management, see:

Best Practices

Use Descriptive Keys

Choose memorable, descriptive keys for your short links (e.g., /summer-sale instead of /x7k9)

Organize with Folders

Group related links in folders for easier management and reporting

Tag Strategically

Use consistent tagging conventions across your team for better filtering and analytics

Archive, Don't Delete

Archive old links instead of deleting to preserve analytics and avoid broken links

Build docs developers (and LLMs) love