Overview
The redirect endpoint is the core public-facing feature of Macondo Link Manager. It allows anyone to access a shortened link and be redirected to the original URL while tracking click analytics.This is the only public endpoint that does not require authentication. All other endpoints require a valid JWT token.
Redirect to Original URL
Redirects users to the original URL associated with a short code and tracks analytics.Endpoint
Parameters
The unique short code identifier for the link (e.g., “abc123”)
Response
302 Redirect - The user is automatically redirected to the original URL 404 Not Found - Redirects to frontend error page if short code doesn’t existExample Request
Use the
-L flag with curl to follow the redirect automatically.Browser Usage
Simply visit the short link URL in any browser:Click Tracking
When a user accesses a short link, the API automatically tracks the following analytics:Tracked Information
- Timestamp - Date and time of the click
- IP Address - User’s IP address (for geolocation)
- User Agent - Browser and device information
- Country - Determined via GeoIP lookup
- City - Determined via GeoIP lookup
- Bot Detection - Identifies and flags bot traffic
Bot Filtering
The system uses sophisticated bot detection to ensure accurate analytics:Bot Detection Criteria
Bot Detection Criteria
The API checks for common bot patterns in the User-Agent string, including:
- Search engine crawlers (Googlebot, Bingbot, etc.)
- Social media bots (facebookexternalhit, Twitterbot)
- Monitoring services
- Automated testing tools
isBot: true and excluded from dashboard metrics.Geolocation
The API uses MaxMind GeoLite2 database to determine geographic location from IP addresses:Error Handling
Link Not Found
If the short code doesn’t exist in the database, the user is redirected to the frontend error page:Implementation Details
The redirect endpoint is implemented in
/api/src/routes/redirect.ts and uses the LinksService to look up the short code and track the click.Redirect Flow
Performance Considerations
- Database query is optimized with an index on
shortCodefield - Click tracking is asynchronous to avoid delaying the redirect
- GeoIP lookups use an in-memory database for fast location resolution
Security
Best Practices
- Always review links before creating them
- Use the preview feature in the dashboard to verify destinations
- Monitor analytics for suspicious activity patterns
- Consider implementing URL validation rules for your organization
Example Use Cases
Marketing Campaign
Create a short link for a marketing campaign:Social Media Sharing
Short links are perfect for character-limited platforms:QR Codes
Generate QR codes that point to short links for print materials and events. The frontend provides built-in QR code generation for every link.Next Steps
Create Links
Learn how to create and manage short links
View Analytics
Track clicks and analyze link performance
