Adding Accountability to Offline Marketing with URL Tracking
Vanity URLS (like those used in TV, print, etc) can, and should, be tracked in Google Analytics to add accountability to offline marketing. With that in mind we decided to put together a step-by-step guide to effectively tracking vanity URLs. This is a critical component for online marketers looking to add accountability to marketing efforts for their clients.
There are some good references out there, including this one by Avinash Kaushik (I’m an admitted fanboy) but I thought a step-by-step process for tracking vanity URLs was in order for the SEOs out there who are looking for a way to get it done. So here we go.
Vanity URL Tracking: Introduction
First, just to clarify, we’re talking about tracking a URL, typically used in traditional advertising like print, radio, and TV, that points to your main website URL. For this post we’ll say you’re company is Widget Blaster and your main website is WidetBlaster.com. You’ve decided to use a vanity URL, WidgetsXYZ.com for a TV spot that’s about to drop. The WidgetsXYZ.com URL is going to redirect to the main site, WidgetBlaster.com. The issue is, just setting up a 301 redirect or domain forwarder through your hosting company isn’t going to pass on the tracking information you need. You may also want to reuse this URL later for a different marketing effort. This is where vanity URL tracking comes in handy.
Vanity URL Tracking: Step-by-Step
Now that we know which URL we want to track and where the vanity URL will point, we can begin the process of setting up vanity URL tracking.
Step 1. Set up hosting for the vanity URL
By establishing a hosting account for the vanity URL, you will have access to a .htaccess file specifically for the vanity URL through the hosting company. Check with your hosting company about the technical component of this if you are unsure how to access the .htaccess file once hosting has been configured. Some hosting companies may not require you host the vanity URL to have access to the .htaccess file.
Step 2. Create Campaign Parameters
Using Google’s free URL Builder, you can easily create a custom tracking string which will be appended to the end of your tracking URL, passing critical campaign information through to your Google Analytics account. In the screenshot below you can see I entered the destination URL and then provide a Campaign Source, Campaign Medium, and Campaign Name. All three of these are required. Once you've entered the campaign fields, click Generate URL in step 3 and Google's URL Builder generates the tracking URL for you.
Step 3. Redirect Rule in .htaccess
Now that you’ve got your campaign tracking string added to your destination URL, you need to access the .htaccess file for the vanity URL (the reason you set up hosting in Step 1) and add the redirect script. Here’s what that looks like:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*
RewriteRule .* http://widgetblaster.com/?utm_source=TV_Commercial&utm_medium=TV&utm_campaign=Widget_Sale_TV_Spring_2013
The URL used in the Rewrite rule is the modified destination URL created with the Google URL Builder in Step 3. Remember, this gets added to the .htaccess file of the vanity URL, not the destination URL.
Step 4. Confirm it’s Working
Now that the hard part is done, it’s time to make sure your Google Analytics account is receiving the campaign information you configured.
First, try typing in the vanity URL. If the tracking script is working properly, you should be redirected and see the campaign parameters appended to the destination URL. If you don’t see this right away, note that it could take several hours to a day for the redirect to take hold. Also be sure to clear your cache. If you’ve done both of these things and still aren’t seeing the campaign parameters, it may be time to back up and punt.
If you are seeing the campaign parameters, Google Analytics should be receiving the data. Again, this doesn’t happen instantly, so you may give it a day before checking.
To check in Google Analytics, follow these steps:
- Login to Google Analytics
- Click the "Traffic Sources" tab
- Click the "Sources" option from the dropdown menu
- Click the "Campaigns" option from the "Sources" dropdown menu
- This is where your campaign data will live.
Alternately, you can go to "Traffic Sources", "Sources", "All Traffic" and type in the campaign source in the search bar to find any traffic from that source.
If you see results in GA, you are successfully tracking vanity URLs. Sit back and bask in the data! Your clients will love you for improving the tracking capabilities beyond just what happens online.