Marketing vanity URLs

Jun 19, 2015

Vanity URLs are simple but incredibly efficient redirects to help track marketing 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 (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.


Say that you plan to buy a vanity domain called and it needs to redirect to

After pointing the domain’s dns to your server, and creating its vhost (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 case is

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

Now, in order to create vanity urls (i.e: which tracks an email campaign) you can use Google’s URL Builder tool to create our campaign URLS. For example, setting to 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 goes to 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, event registration, form completion, etc - so you can track the effectiveness of your campaign (which now is via an easy-to-remember url).

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