Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We currently have Analytics tracking codes running throughout our site including our Sub Domains.

What I would like to do is create different Profiles under the same account segmenting the sub domains by means of filters.

Currently I am just excluding the hostname of the main website by using the following custom filter:

Exclude: Hostname Filter pattern: ^www.mydomain.co.za(.*)

I know this isn't the proper method of doing this though and have some of the main domains links coming through in the data.

Ideally I would just like to include anything from: sub.domain.co.za

Any help would be greatly appreciated.

share|improve this question

migrated from superuser.com Jan 24 '11 at 12:59

This question came from our site for computer enthusiasts and power users.

    
Could you clarify? Do you want to be able to do a report of all data and one report per sub domain? – Ben Hoffman Jan 24 '11 at 13:31

Try this: http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#multipleDomains

Where you would modify

_gaq.push(['_setDomainName', '.example-petstore.com']);

to

_gaq.push(['_setDomainName', '.mydomain.co.za']);

The profile for each subsite could us a custom filter on hostname to show only traffic to the subsite.

share|improve this answer

Using _setDomainName overwrites the hostname - which means that you can no longer distinguish which subdomain the visit came to.

More specifically sub.mydomain.co.za/index.html and www.mydomain.co.za/index.html would both be tracked as a visit to www.mydomain.co.za/index.html

Perhaps I mis-understand the question, but it sound like what you are wanting is straight-forward - a separate profile filtering traffic for each sub-domain.

Try this:

Custom Filter Include: Hostname Filter pattern: sub\.domain\.co\.za

share|improve this answer
    
"_setDomainName overwrites the hostname" where is this documented? I've seen solutions to this problem similar to the other answer, which also use a hostname filter, but that would not work if this statement is correct. – roryf Oct 19 '12 at 10:38

Your Answer

 
discard

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