I have two domains associated with the same hosting account. Domain A was the one I had purchased when I first set up my website, but I didn't like it all that much and it was getting low ranks, and so I bought domain B and 301'd links from domain A to domain B. Now I would like to know if there is any way I can filter page views on Google Analytics based on the domain used to access the website, so that I can know if it is worth to keep the old domain associated with the account. Is there any easy way I can do this?
You are using a 301 redirect to move traffic from the old domain to the new domain, so there will be no referring data in Google analytics.
Instead, you can tag your redirect URLs to indicate that they come from the old domain. What you need to do is change the 301 redirect target to something like
All visitors from old-domain.com will now display in the Traffic Source reports.
I'm still naïve with Analytics, but I think that this is one way to roughly achieve what you are asking.
1) Make sure the webpages on Domain A have the same Analytics code as Domain B
2) Go to:
Audience > Visitors Flow
3) Click on Domain A (it will show the flow of visitors from Domain A to domain B)
4) Select 'View only this segment'