Tracking Internal Redirects in Analytics and Tracing External Redirects

This post is split into two sections.  The first is for tracking your own internal redirects using Google Analytics.  The second portion is for tracing URL redirect paths.

Tracking Redirects with Google 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 301 redirects with Google Analytics

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

Tracing External URL Redirects

There are several reasons you may want to trace a redirect path or a URL.  A faulty URL on your own site may be redirecting several times and you want to see the entire path.  You may want to trace the entire path of an affiliate’s URL so see the entire path it’s taking.  So here are a few free tools to trace and control redirects while browsing.

Redirect Detective

My favorite part of this tool is that it will list out entire redirect chain and display the URL that’s setting cookies.  In the example below, this was used to expose certain tracking errors.

Redirect Tracker

HTTP Status Code Checker

My favorite part of this tool is that you can enter multiple URLs at once, you can hover over the final 200 status icon and see some basic header information, and most importantly, the redirect source and destination URLs (the URL on the secondary domain) can be exported.

Track Redirects

Redirect Path

Unlike the other two, this one is a Chrome extension and works by tracing redirect paths of URLs you’ve actually browsed.

Trace and Control a redirect while browing

 

Comments (19)

  1. Chee says:

    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

  2. Chris says:

    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

  3. Chee says:

    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

  4. Chee says:

    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

  5. admin says:

    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.

  6. JC says:

    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

  7. JC says:

    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

  8. admin says:

    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.

  9. admin says:

    JC,

    I just posted a followup regarding your find.

  10. Jon says:

    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.

  11. admin says:

    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.

  12. Gel says:

    Hi. I am hoping you could help me. I want to track a link from an email to an external link. Is this possible? Do I need to set up a page on my website that will redirect to the external to get a rough estimate of how many people actually clicked on the original email link? Thanks for your time and help!

  13. admin says:

    Hello,

    In order to track email clicks in Analytics you would indeed have to make sure the links pointed to a page that runs your analytics script. So either the links themselves would have to be your pages, or as you stated, they would need to redirect.

    Also, I’m not sure what you mean by email. In the event you weren’t referring to a personal email but rather an email marketing campaign, then it’s possible the software you’re sending from (assuming you’re using software) tracks these clicks.

    I hope this helps.

    –Chris

  14. Johann says:

    Good Day.

    Please advise i have a domain called http://www.vtp.co.za but gets redirect to http://www.virtualtours360.3.co.za—the virtual tours 360 domain has google analytics setup will it track or registered on google analytics if there is redirect coming in from http://www.vtp.co.za ? Will its register as a hit or visit if the user got redirected from http://www.vtp.co.za to http://www.virtualtours360.co.za ? ?

    1. admin says:

      Hey Johann – In that case, I believe it will show up as a direct visit on the virtualtours360 GA account.

Leave a Reply

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