Tracking Campaigns In Google Analytics Using 301 Redirects
We’ve explained previously how you can track offline campaigns using short urls, but you might want to keep advertise using your full website address for branding purposes (as opposed to using something like Tinyurl or Bitly or a shortened version of your domain name).
You can do this simply by adding a 301 redirect to a unique url –
e.g. digitangle.co.uk/campaign-name so that it redirects to your destination url with the additional tracking parameters on the end –
To do this, you’ll need to open your .htaccess file, which normally lives in the root of your website.
Locate or create your page
Create your landing page, or save the page location if it already exists, and decide on what you’re going to use as the short version. This can be short catchy name or a reference, the page won’t actually exist, we’ll be redirecting it to the real address. Think of this as a PO box address that you might use to advertise.
Create your tracking url
Decide how you want to see the results of the campaign. What will you call the source, medium and campaign name?
Use the destination page (the real address of your landing page), and add the Google Analytics tracking code. You can do this using the Google Analytics url builder.
Open your .htaccess file using your hosting file manager or FTP tool.
Normally this is in the highest level of your website folders along with your index).
Create a copy and save it somewhere. Be poised to reinstate your original version.
Add the redirect (see below for the format).
This tracking url lets you see in Google Analytics whether people actually visit your site after seeing offline campaigns.
Make sure you test that your website works perfectly and that the redirect takes you to the correct place, then promote your offline campaign and check back to your analytics account to see the results.