Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Suppose I have the website www.example.com and www.example2.com. I redirect all page requests from www.example2.com to their corresponding pages at www.example.com. Is there a way for Google Analytics to track visits at www.example2.com?

I read http://www.google.com/support/analytics/bin/answer.py?answer=55503 and suggested to add tracking code to the links on my second domain (www.example2.com). However, I don't have pages in my second domain as it always redirects to the other one.

Is it possible to track multiple domains this way?

share|improve this question

migrated from stackoverflow.com May 2 '11 at 2:25

This question came from our site for professional and enthusiast programmers.

    
If they are never on example2.com because of the redirect, how can you track them if they can ever use the example2.com website at all since it really doesn't exist? –  John Conde May 2 '11 at 3:21
    
Precisely. Thinking of putting GA code in one page then do redirects using javascript. What could be the negative implications? –  Dave May 2 '11 at 3:39
    
Doing redirects with JavaSCript is a bad idea. If someone doesn't use JavaScript, like search engines, they don't get the redirect. Then you have duplicate content issues and can confuse your users. Use a server side 301 redirect. That's the infallible way for this to be done. –  John Conde May 2 '11 at 11:40
add comment

2 Answers

up vote 0 down vote accepted

There is a setting when adding your GA code to allow for multiple domains.

share|improve this answer
add comment

You could treat your redirecting domain as a campaign and append campaign variables to the redirected URL.

For example:

http://www.example2.com/page/

... could redirect to:

http://www.example.com/page/?utm_source=example2.com&utm_medium=Redirect&utm_campaign=Redirects

(i.e. your redirect would always append the ?utm_source=example2.com&utm_medium=Redirect&utm_campaign=Redirects query to instruct Google Analytics to track the hit as a campaign link; the downside to this method is that, should the visitor share the link with the appended query string, other hits which are not necessarily redirects would appear under the Redirects campaign)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.