Thursday, October 25, 2007

Google Analytics installations for Sub Domain

If you want to track the data of sub domain for your site, you needto be made to the initial Google Analytics tracking code. A sample for subdomain tracking code is given below.




Minor Change in below code from:

<script src="http://www.google-analytics.com/urchin.js"

type="text/javascript">

</script>

<script type="text/javascript">

_uacct = "UA-xxxx-x";

urchinTracker();

</script>

to

<script src="http://www.google-analytics.com/urchin.js"

type="text/javascript">

</script>

<script type="text/javascript">

_uacct = "UA-xxxx-x";

_udn="example.com";

urchinTracker();

</script>

The primary domain should replace example.com.

2 comments:

csandberg said...

What would happen if you only placed the modified on code on pages on the subdomain, but left the un-modified code on all pages on the main domain?

Adam Caitlin said...

pages contained un-modified code will not tracked by analytics.