Vanity URLs are short, memorable redirects that make offline and campaign traffic easier to track in analytics. They are simple to operate, but only useful when the rewrite rules and UTM parameters stay maintainable.
Production context
- When to use this: print, QR, email, or partner campaigns that need trackable entry points without exposing fragile destination URLs.
- What it improves: campaign attribution, routing clarity, and the ability to change destinations without reprinting collateral.
- Tradeoff: redirect sprawl becomes hard to audit. Keep campaign rules documented and avoid one-off rewrite exceptions.
This note covers:
- Tracking traffic from printed leaflets and posters
- Using Google Analytics to assess printed campaigns
- Creating vanity URLs with Apache rewrite rules
- Measuring campaign ROI with goal tracking
Requirements
- Domain(s) that you want to use
- Server with Apache (or any other web server)
- I run my servers on DigitalOcean and * Signing up to DigitalOcean via this link, you receive a $50, 30-day credit as soon as you add a valid payment method to your account.
- Manually register the virtual hosts for each domain you want to process, or via a tool like Plesk or cPanel (under parked domain section) if you have a managed server.
- A documented naming convention for campaign source, medium, and campaign values.
Process
Say that you plan to buy a vanity domain called icecream2015.com and it needs to redirect to 2015.icecream.com
After pointing the domain DNS to your server and creating its vhost (in cPanel, add it as a parked domain), add the following
RewriteRule that will redirect www.icecream2015.com and/or icecream2015.com to your live site, which in this case is 2015.icecream.com
RewriteCond %{HTTP_HOST} ^(www\.)?icecream2015\.com$ [NC]
RewriteRule ^/?$ "http\:\/\/2015\.icecream\.com" [R=301,L]
Now, to create vanity URLs (for example, icecream2015.com/cornilla for an email campaign), use Google's URL Builder tool
to build the destination URL. For example, redirect icecream2015.com/cornilla to 2015.icecream.com/catalog/cornetto/vanilla?utm_source=Cornetto&utm_medium=email&utm_campaign=vanilla_flavour.
Add the matching rewrite rule:
RewriteCond %{HTTP_HOST} ^(www\.)?icecream2015\.com$ [NC]
RewriteRule ^cornilla/?$ "https://2015.icecream.com/catalog/cornetto/vanilla?utm_source=cornetto&utm_medium=email&utm_campaign=vanilla_flavour" [R=302,L]
And that is it. Requests to www.icecream2015.com/cornilla or icecream2015.com/cornilla redirect to https://2015.icecream.com/catalog/cornetto/vanilla?utm_source=cornetto&utm_medium=email&utm_campaign=vanilla_flavour.
Google Analytics campaign parameters are connected to configured conversions, whether that is a purchase, registration, form completion, or another event.
GA4 and campaign hygiene
In GA4, use consistent UTM values so campaign reports do not fragment across spelling variations:
utm_source: where the traffic originated, such asposter,leaflet,newsletter, or a partner name.utm_medium: the channel, such asprint,email,qr, oroffline.utm_campaign: the campaign name, such assummer_icecream_2015.utm_content: optional placement or creative variant.
Avoid mixing case, spaces, and ad hoc abbreviations. Cornetto, cornetto, and cornetto_email will create avoidable reporting noise.
Operational considerations
Use permanent redirects (301) only when the destination is stable. For short campaigns, tests, or destinations likely to change, use temporary redirects (302) until the final route is proven.
Also track the fallback path. Not everyone will type the full vanity URL. Some visitors will enter only the domain, scan a QR code, or mistype the campaign path, so campaign reporting will be directional rather than perfect.
Verification
Before printing or sending a campaign:
- Test the bare domain and every vanity path.
- Confirm the final URL includes the expected UTM parameters.
- Confirm redirects do not chain unnecessarily.
- Confirm HTTPS works on both vanity and destination domains.
- Confirm analytics records the campaign in a test visit.
Related work
This routing pattern supports maintainable campaign delivery in Delivery quality with Playwright and application platform work.