This Cloudflare Worker-based service allows users to convert Steam Vanity URLs and SteamID-based profile URLs into Dotabuff player profile links. It automatically handles Steam Vanity URLs by resolving them through the Steam API and processes SteamID64 and Steam3 formats locally without API calls.
- Supports Steam Vanity URLs (e.g.,
steamcommunity.com/id/gabelogannewell→ API resolution required) - Handles SteamID-based URLs locally (e.g.,
steamcommunity.com/profiles/76561197960287930→ converted without API) - Automatic Redirects to Dotabuff player profiles
- Google Analytics Integration (ensuring tracking before redirection)
- Cloudflare Workers Optimization
- Secure API Key Handling using Cloudflare Worker Secrets
- Vanity URLs: If a user enters a Steam Vanity URL (
/id/{username}), the service queries the Steam API to resolve the corresponding SteamID64. - SteamID64 URLs: If a user enters a
/profiles/{SteamID64}, the system locally converts it to a Dota 2 Player ID. - Steam3 IDs: If the URL contains a Steam3 ID format (e.g.,
[U:1:22202]), it is converted directly without API usage. - Google Analytics: The redirect page ensures Google Analytics tracking before sending the user to Dotabuff.
- Vanity Name URL:
https://steamcommunitx.com/id/{username}(Requires API resolution) - SteamID64 URL:
https://steamcommunitx.com/profiles/{steamID64}(Converted locally) - Steam3 ID URL:
https://steamcommunitx.com/profiles/[U:1:{dotaID}](Converted locally)
All formats redirect to Dotabuff:
https://www.dotabuff.com/players/{dotaID}
- Clone the repository and navigate to the project folder.
- Deploy the worker using Cloudflare’s dashboard or Wrangler CLI.
Go to Cloudflare Dashboard → Workers & Pages → Select Your Worker → Settings → Variables and Secrets.
Required:
STEAM_API_KEY(secret) — your Steam Web API key from https://steamcommunity.com/dev/apikey
Optional:
STEAM_API_KEYS(secret) — comma-separated list of additional Steam API keys for rotation under load. Whitespace around commas is trimmed automatically.GA_ID(var) — Google Analytics 4 measurement ID (e.g.G-XXXXXXX). Injected into the<head>of every HTML page. Omit to disable GA.MATOMO_URLandMATOMO_SITE_ID(var) — Matomo tracker base URL (must end with/, e.g.//m.example.com/) and numeric site ID. Both are required together; either alone is ignored. Omit to disable Matomo.
Analytics values are validated against strict format guards before being inlined into HTML, so a malformed value is silently dropped rather than producing broken markup.
The worker uses two KV namespaces. Both are optional — the worker degrades gracefully if a binding is missing, but you lose caching / health tracking.
Create namespaces in Workers & Pages → KV, then bind them to the worker under Settings → Variables and Secrets → KV Namespace Bindings:
| Variable name | Purpose |
|---|---|
STEAM_ID_CACHE |
Caches resolved vanity → steamID64 for 30 days. |
API_KEY_STATUS |
Marks invalid / rate-limited API keys so the next request skips them. |
Note: a previous version of the worker used a
RATE_LIMITSKV binding for in-worker rate limiting. That has been removed — KV is not suitable for atomic counters. If you need rate limiting, configure it via Cloudflare WAF Rate Limiting Rules or the native Workers Rate Limiting binding.
To use a custom domain like steamcommunitx.com, configure Cloudflare DNS settings and map the domain to the worker.
worker.js: The main Cloudflare Worker script that handles requests, processes Steam IDs, and redirects.README.md: This doc.
The original 2017 PHP prototype is preserved on the
legacy-php-2017branch for historical reference.
- Uses
window.onloadto ensure all tracking scripts load before redirecting. - Redirects both SteamID-based URLs and Vanity URLs to Dotabuff.
- Implements proper error handling for missing API keys and invalid Steam IDs.
Feel free to submit pull requests for improvements, bug fixes, or additional features.
MIT License.