Track Redirects in Analytics - How to Track a Redirect in Analytics

One of the problems people run into is their inability to track redirects in Google Analytics. For example, let’s say you purchase radio or print ads in order to advertise a product. Rather than simply advertising your domain name (ie (www.yourdomain.com), you may add an easy to remember folder name (ie. www.yourdomain.com/adpage), which redirects to the appropriate product page (which is probably too long and complicated to display on a radio, TV, or print ad).

Depending on the type of redirect you use, Analytics may not be able to track visits and user behavior. Fortunately, there are at least 2 ways you can track redirects. In both instances, you have to make sure the directory actually exists as a file (ie. /adpage/index.php). The difference lies in the type of redirect you use. If you use a 301 redirect, you’ll want to add campaign tracking to the url you are redirecting to, so Analytics can track visits as a campaign. The other option is to use a standard javascript redirect, and add the Analytics tracking to the redirecting page (ie. /adpage/index.php). This way, you can track visits and user behavior in the Analytics Content section.

Let’s say you are advertising the following page via radio ads:

www.yourdomain.com/adpage

This page actually redirects to the page below

www.yourdomain.com/long-url-product-page.php

Here are two ways you can track visits and user behavior for people landing on www.yourdomain.com/adpage.

1- Tracking a redirect using a 301 redirect:

Add campaign tracking to your forwarding page. So, on this page:

www.yourdomain.com/adpage/index.php

Rather than 301 redirecting to:

www.yourdomain.com/product-page.php

The 301 redirect should actually redirect to:

www.yourdomain.com/product-page.php?utm_source=yoursource&utm_medium=yourmedium&utm_campaign=yourcampaign

You will then be able to track the number of times www.yourdomain.com/adpage was visited by looking at your new Campaign (under Traffic Sources) metrics.

2- Tracking a redirect using a javascript redirect:

Make sure your analytics tracking is on your redirecting page, before the script to run your redirect. So on this page:

www.yourdomain.com/adpage/index.php

Make sure your analytics tracking code appears before your redirect runs.   You will then be able to track the number of times www.yourdomain.com/adpage/index.php was visited by looking at your Top Content or Top Landing Pages (under Traffic Sources).

*** This method only works efficiently if you implement a time delay in the JavaScript redirect.  Otherwise, the Analytics script won’t always finish running before the page redirects, and your Analytics reports won’t capture every redirect.  Read more on this related post: Update on Tracking JavaScript Redirects

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

Hi Chris, thanks for your interesting post. I have the following questions which I hope you can help me out with:

1. How do I track which outbound links (anchor text link, image link etc.) on my exit page leads the visitor to leave my site?

2. So far I have only used GA to track the number of visitors to my site. Now I would like to track the number of conversions (sales of affiliate offers) using GA. How is the conversion tracking possible when I can’t place the GA codes on the success page of the affiliate offer?

3. This is somewhat related to question #2. I use a header redirect in for example /offer-name.php to redirect the visitor to the offer. Is javascript redirect as you mentioned in your post the better way to track conversion, if tracking affiliate offer as described in question #2 is possible at all?

Thanks,
Chee

Hi Chee,

Thanks for visiting and for the great questions!

1- You can track outbound links using the EventTracking function in Google Analytics. You can read how to do this on a previous post.

Track Redirects in Analytics - How to Track a Redirect in Analytics
http://www.seoracle.com/google-analytics-how-to-tutorial/track-outbound-links-and-file-downloads-with-google-analytics

2- In regards to tracking affiliate activity, I assume you are asking how to track outbound activity (meaning you are on the publisher side)? Generally this is worked out through the affiliate network medium. For example, Commission Junction uses a tracking pixel to track transactions coming from publisher websites. All of the reporting is handled through Commission Junction’s reporting interface.

3- I would only try something like this if you are unable to track using an affiliate network. There are some ways to track conversions on 3rd party shopping carts, but this may prove difficult if you are using redirects to drive visitors to other websites.
http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55532

I hope this helps.

Chris

Chris, thanks so much for answering my questions. I have gone through your post titled “Track Redirects in Analytics - How to Track a Redirect in Analytics”. It raised up other questions for me. The outbound link that leads a visitor to leave my site isn’t really an outbound link in the sense that it is actually a php file on my website with a header redirect which only contains my affiliate link. Assuming that the affiliate network has my tracking pixel set up:

1. Will EventTracking still be working fine in this case so that conversion (sale) can be tracked properly and viewed in my GA account?

2. How should the outbound link look like in the above-mentioned situation in which the link isn’t a “real” outbound link? Is it something like this:

3. Should the redirect php file contain any GA code in order to make EventTracking work?

Thanks,
Chee

Sorry, I think comment was converted into rich text format. Here is the code for question #2 again:

<a href=”http://www.mysite.com/offers/offer-name.php” onClick=”javascript: pageTracker._trackPageview(’http://www.mysite.com/eventtracking/external/offer-name’);”

Thanks,
Chee

[...] How to Track a Redirect in Analytics [...]

Hi again Chee,

I wouldn’t suggest mixing and matching the EventTracking with the redirects you are using. I guess I didn’t realize your question 1 and 3 were so related. It probably is possible to use EventTracking to track the redirect, assuming the redirect can be used to call the function. But assuming this is even possible, this is more JavaScript than I know.

[...] Re: tinyurl .. no more! Hi Cindy, This may help: Track Redirects in Analytics - How to Track a Redirect in Analytics (Javascript & 301 Redirects) [...]

Hi,

i tried doing the javascript redirect and the google analytics, but the tracking has not been consistent (out of 8 tests, only 4 got tracked). It looks as if the time it takes for the script to contact google analytics is too slow so the redirect javascript does the redirect before the hit is recorded on google.

_uacct = “UA-5*****-*”;
urchinTracker();

i pasted what i have on the redirect page.

is there anything i can do to keep the redirect tracking consistent?

Thanks

i noticed the entire paste did not display.
after the google analytics script, i have a second script, which is the javascript redirect.

window.location = “http://www.website.com”

they are both in their own script tags with the GA script before and the redirect after.

thanks
jc

Hi JC,

Thank you for bringing this to my attention. I am in the process of testing this using a delay in the redirect (vs a control version that contains no delay), to see if that makes a difference. I will let you know what I find.

Once again, thanks for bringing this to my attention.

[...] a previous post (Track Redirects in Analytics), I gave a couple of examples on how you can track redirects using Google Analytics.  One of these [...]

JC,

I just posted a followup regarding your find.

Great post here. Thanks for sharing. One question though.

I am using a vanity url in an email campaign that looks like this: http://www.mysite.com/joinme?utm_source=google&utm_medium=cpc&utm_campaign=Content

This vanity url redirects to this page: http://www.mysite.com/register.jsp

The problem is, when someone clicks on the vanity url and goes to http://www.mysite.com/register.jsp, none of the UTM tags in the tagged vanity url are present. They’re missing, so nothing is getting tracked. All I see in the address field is http://www.mysite.com/register.jsp.

Also, if this same vanity URL is being used on my Web site, will the UTM tags appear in the URL if someone clicks on the link from the Web site?

What do I do?

Thanks.

Hello there,

The tracking parameters need to be added to the resulting URL, not the one redirecting to the resulting URL.

In other words,

http://www.mysite.com/joinme

Should redirect to

http://www.mysite.com/register.jsp?utm_source=google&utm_medium=cpc&utm_campaign=Content

Or,

http://www.mysite.com/joinme itself should have Analytic tracking embedded within the page itself, and a Javascript tracking should be used (placed after the tracking code and with a 1 second delay).

I hope this helps.

Leave a comment

(required)

(required)