I have a website and two urls active for the same home page. one is example.com and one is www.example.com. I was getting 2000 hits every day. Suddenly traffic decreases to 200. I have analyzed that Google search result was displaying my example.com domain. When traffic decreases i found that Google displaying www.example.com in search result. In cache version of both page have same analytics code. Is there any reason of traffic decreases and how can I solve this? Does Google adds the hit for both domain and displays it? OR My traffic is now going to www.example.com and that is the reason that I can't see the hits. I am tracking only example.com.
You should always redirect your traffic from one to the other. Else you'll get penalty for duplicate content, as your website is accessible on both URL. Use an .htaccess redirection to do that (Google it).
I agree with a 301 redirect, in theory at least. But it hasn't worked all that great for me. My site got restricted in terms of traffic and wasn't picking up backlinks properly. Once I removed it, my pages started to get indexed properly, backlinks came back etc. Also I have my default domain is Google Webmasters set as www. I don't know if this helps. But I haven't noticed any traffic coming in from the other URL. Webmasters is empty for the other site. I monitor them both.