Marketing vanity URLs

Jun 19, 2015

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:


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, 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. Update 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