Alex Budurovici

London software engineer

Marketing vanity urls

Vanity urls are simple but incredibly efficient redirects to help the marketing teams track their  campaigns via Google Analytics, in this case, and help build reports or track their effectiveness.

This is a small walk-through on:

  • How to track traffic to websites from printed leaflets and posters
  • How to use Google Analytics to asses printed marketing campaigns
  • How to create vanity urls
  • How to check ROI (Return on investment) for printed adverts


  • Domain(s) that you want to use
  • Server with Apache (can use any other service)
  • 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.

Say that you plan to buy a vanity domain called and you’ll want the base redirect to be to After pointing the domain’s dns to your server, and creating vhost for it (in cPannel, you’d add it as a parked domain), you proceed to add the following RewriteRule that will redirect and/or to your live site, which in this example will say that is

RewriteCond %{HTTP_HOST} ^(www\.)?icecream2015\.com$ [NC]
RewriteRule ^/?$ "http\:\/\/2015\.icecream\.com" [R=301,L]

After that, I assume that you’d want to proceed onto creating those vanity urls, that will be unique for everything that you want to track. Say that would be a link to track an email campaign for a Cornetto (no relation) vanilla ice cream. Well, using a Google’s URL Builder tool we can easily create our campaign URLS, for example: for the link above, it would redirect to

Only thing remaining, is to write the rule:

RewriteCond %{HTTP_HOST} ^(www\.)?icecream2015\.com$ [NC]
RewriteCond %{THE_REQUEST} /tm
RewriteRule . "http:\/\/2015\.icecream\.com\/cornetto\/vanilla?utm_source=Cornetto&utm_medium=email&utm_campaign=vanilla_flavour" [R=301,L]

And voila! When anybody would access or, they would get redirected to

Of course a Google Analytics campaign code is automatically connected to all of the goals you set up in GA, whether they are an item sale, even registration, form completion, etc – so you can see what effect your printed marketing (which has your easy-to-remember web addresses on) has on your business targets, whether they are sales or information based.

Remember though that not all people will add the ‘vanity’ part of the URL, so these campaigns will be indicative rather than perfect.


Fixed link to point to Google’s new Campaign URL Builder. Thanks to Prateek for pointing this out; go and checkout his detailed tutorial on how to use the tool at


Alexandru Budurovici • June 19, 2015

Previous Post

Next Post