Tracking Campaigns In Google Analytics Using 301 Redirects

Tracking Campaigns In Google Analytics Using 301 Redirects

Tracking Campaigns In Google Analytics Using 301 RedirectsWe’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. 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.

This is a crucial file, so take a copy and keep it handy in case you make a mistake that breaks your website!


Step 1:

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.

Step 2:

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.

Step 3:


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).

What you’re doing above is adding a redirect from your pretend campaign link that you’ll print in your offline campaigns, and pointing it to your actual page with the tracking code in place.

This tracking url lets you see in Google Analytics whether people actually visit your site after seeing offline campaigns.

Redirect code to add to your .htaccess file:

redirect 301 /where-you-take-people-from

Using the example campaign from before, it looks like this:

redirect 301 /campaign-name

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.

Leave a comment

Your email address will not be published. Required fields are marked *