Forum Moderators: DixonJones

Message Too Old, No Replies

Tracking a 301 redirected external link

How to track a 301 redirected link in GA?

         

CainIV

9:10 pm on Nov 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi guys, hoping that some of the experts here can help me find a solution for tracking external links that are 301 redirected using htaccess.

All I want to do is find a way to track external links, and if possible, track each one from any given page on my website.

tonynoriega

4:08 pm on Nov 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



per google, this might help:
Google Analytics provides an easy way to track clicks on links that lead away from your site. Because these links do not lead to a page on your site containing the UTM JavaScript, you will need to tag the link itself. This piece of JavaScript assigns a pageview to any click on a link - the pageview is attributed to the filename you specify.

For example, to log every click on a particular link to www.example.com as a pageview for "/outgoing/example_com" you would add the following attribute to the link's tag:

<a href="http://www.example.com" onClick="javascript: pageTracker._trackPageview('/outgoing/example.com');">

It is a good idea to log all of your outbound links into a logical directory structure as shown in the example. This way, you will be able to easily identify what pages visitors clicked on to leave your site.

CainIV

5:10 pm on Nov 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thankyou Tony for the info. Does this apply however when the link the user clicks 301 redirects to the website - in other words, it is not a physical link to that person's website but rather is handled as a 301?

cgrantski

5:32 pm on Nov 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Okay, when you say "external links" you are referring to inbound links from an external source that uses a 301 redirect? This is a little confusing.

Have you searched through Google Analytics help for this topic?

Tagging does not work well with this kind of inbound situation. You might have to analyze your server logs.

ZydoSEO

7:06 pm on Nov 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yea. I'm a little confused as well.

Are you trying to figure out

1) when an external site links to an old URL on your site which you have since 301 redirected to a different page on your site? or

2) when a link on your site to an external site links to an old page on the external site which results in a 301 firing on that external site to redirect your link to a different page on the external site (or another external site)? or

3) something else?

#1 is fairly straight foward. You should be able to look for page requests where the referer is an external domains for which your web server(s) returned a 301.

#2 I think would require something crawl your sight for external links, request those pages to which you link, and check the return status for a 301 instead of a 200.

[edited by: ZydoSEO at 7:07 pm (utc) on Nov. 25, 2008]

CainIV

8:41 pm on Nov 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi guys. I want to track outbound links from my domain to another external domain using a 301 redirect, and find out how to specifically track each link using Google Analytics

tonynoriega

3:05 am on Nov 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



what i provided will show up in your "Content" area of your analytics.

when you search your content area for "/outgoing/example.com"
it will show you how many visitors clicked that link to go outside of your domain...

the 301 on the other side should not make a difference.

when you tag your outbound link as such:
<a href="http://www.example.com" onClick="javascript: pageTracker._trackPageview('/outgoing/example.com');">

this will count how many times someone clicked the outbound link.

it works for my site just fine.

i have an outbound link to a medical site that is not my domain... it wouldnt matter if the link was a 301 redirect, its only tracking how many times someone clicked that link.

i think that is what you are looking for.

CainIV

4:18 am on Nov 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks alot for the info! Will try this out :)