A simple static-site toolchain to generate and serve tracked, secure redirects via GitHub Pages.
Purpose
- Maintain a centrally managed list of approved destination URLs in
allowed.json
. - Provide an interactive form (
generate.html
) for users to generate UTM‑tagged redirect links. - Enforce domain/URL whitelisting in the redirect logic (
index.html
). - Track every redirect in Google Analytics before handing off users to the final destination.
├── allowed.json # Whitelist of fully-qualified URLs
├── generate.html # Interactive redirect‑link generator UI
├── index.html # Secure redirect page with GA tracking
├── README.md # This documentation
├── .github/ # CI/CD, linting, security workflows
└── renovate.json # Dependency update config
- Web Editor: Navigate to this repository on GitHub and press the
.
key to open the cloud IDE. - Add URL: In the web editor, open
allowed.json
and add your destination URL to theallowed_urls
array. - Commit & PR: Commit your changes (directly or via a branch) and open a Pull Request against
main
to approve new URLs. - Deploy: Once merged, GitHub Pages will automatically deploy your updates.
- Generate: Open
generate.html
to build UTM-tagged redirect links. - Track & Redirect: Visitors clicking those links will hit
index.html
, fire a GA event, then be forwarded to the allowed URL.
-
Open
allowed.json
in the repository root. -
Add your new, fully URL‑encoded destination to the
allowed_urls
array:{ "allowed_urls": [ "https://example.com/page?utm_source=...", "https://another.allowed.site/path" ] }
-
Create a Pull Request targeting
main
:- Title: **Add allowed URL: **
<your URL>
- Body: short description and reason for the redirect.
- Title: **Add allowed URL: **
-
After review and merge, your URL is live and can be used in
generate.html
.
-
Open generate.html in your browser (e.g. via GitHub Pages).
-
Enter:
- Destination URL (must match an entry in
allowed.json
). - UTM parameters (source, medium, campaign, etc.).
- Destination URL (must match an entry in
-
Click Generate Link.
-
The full redirect URL (pointing to
index.html?…
) is produced and auto‑copied to your clipboard. -
Share that link in your newsletter, email, or other channels.
index.html
fetchesallowed.json
at runtime.- It rejects any
redirect-url
not exactly listed inallowed_urls
. - Fires the GA
gtag('config',…)
call with campaign data. - Redirects only valid, whitelisted URLs after a short delay.
- Written as a fully static site.
- GitHub Actions workflow (
.github/workflows/deploy-static.yml
) auto‑deploys on everymain
push. - SSL and custom domain support via GitHub Pages settings.