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

I'm not pretty sure if this question is programming related, so I'm sorry if it's not.

The situation is like this. I have a domain (www.domain1.com for example). I would like to redirect all visitors that goes to www.domain1.com to my other domain(www.maindomain.com). www.domain1.com doesn't have any contents or page, so simply I can do dns redirect or whatever just to redirect the visitors to my domain. My question, is there a away that I can count the visitors through analytics or some sort that goes to www.domain1.com?

Your help is greatly appreciated.

Best regards,

share|improve this question

migrated from stackoverflow.com Apr 27 '11 at 3:39

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

If the referrer is set for redirects, you could check that. –  alex Feb 15 '11 at 1:27
Hi, I'm not sure what you meant. Can you give me an example? –  Shen Lance Feb 15 '11 at 5:50

1 Answer 1

If you're using Google Analytics, you have a few options.

  1. Rather than redirecting to www.maindomain.com, redirect to www.maindomain.com/?utm_medium=referral&utm_source=domain1.com. This will show up in your reports as if the visit has originated from a referrer of 'domain1.com'. Perfect. However, this will overwrite any existing source/medium data attributed to that visitor... e.g., if they come from Google via organic search and enter via domain.com, they'll be reported as a referral from domain1.com rather than an organic visitor from Google.

  2. Rather than redirecting to www.maindomain.com, redirect to www.maindomain.com/?redir=domain1.com. Use conditional logic in the page to determine if there's a value present for the redir value, and then use Google Analytics custom variables to create a session-level custom variable to identify and be able to flag/segment these visitors.

If you're using a different Analytics package, the solution should in theory be adaptable - you're either looking at utilising campaign tracking parameters to manually specify a source/channel, or you'll need to use conditional logic within the page to determine the source and output custom code/behaviour appropriately.

Good luck!

share|improve this answer
+1. #2 is a better solution. –  Yahel Feb 28 '11 at 20:55

Your Answer


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