Sub-Domain and Cross Domain Tracking
Millions of website admins use google analytics code to track the traffic on their website. However, Google Analytics does not automatically track a single visitor across different domains or sub-domains using the default set of tracking code, so some customization of the default code has to take place.

Google has given customization example in their support forums, please check the following article.
Read more from Google Analytics Tracking Across Multiple Domains and Sub-domains
For getting Tracking code login to http://www.google.com/analytics/
Millions of website admins use google analytics code to track the traffic on their website. However, Google Analytics does not automatically track a single visitor across different domains or sub-domains using the default set of tracking code, so some customization of the default code has to take place.

Google has given customization example in their support forums, please check the following article.
Read more from Google Analytics Tracking Across Multiple Domains and Sub-domains
For getting Tracking code login to http://www.google.com/analytics/