Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics with subdomains and aggregating data

I am building a network of sites that have a single main domain at example.com and several regional sites that use subdomains of the main one, such as:

  • example.com
  • site1.example.com
  • site2.example.com

I have two goals for setting up Google Analytics with this network, but I'm afraid it may be contradictory based on how GA works:

  1. I want to give each subdomain its own GA account so that managers of the regional sites can see their stats, but not the other regional sites.

  2. I want to be able to aggregate all of the regional site data with the national site data for executive management review.

While it's pretty easy to set each of these sites up with a Google Analytics account of their own, I don't know if this is the right way to go.

Can I satisfy the requirements of goals #1 and #2 with Google Analytics? If yes, how can I best execute it?

like image 669
Randy Burgess Avatar asked Oct 11 '22 07:10

Randy Burgess


1 Answers

One way to do it would be to have your page code point to the same profile (same UA-XXXXXXX-X) but set up separate profiles based on that same profile. Then use filters to send data based on the subdomains.

That way you don't need to mess with having multiple versions of your page code. But, you will need to add to your page code for all your pages (on all your subdomains) the following (before the trackPageview call), to make sure all subdomains are tracked:

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

Then you would apply filter to each profile with:

  • Filter Name: site1 traffic
    (Predefined filter)
    • Filter type (dropdown values):
      • Include only : traffic from the domains : that are equal to
      • Domain: site1.example.com

Do that for each profile you setup for each site.

As far as #2, you'd just have the first profile you spawned all those other profiles off of (above) as a "global rollup" without any filters, so it will get all the traffic.

And you can specify who has access to what profiles in the profile editor.

One bummer is that you will need to go in and setup your goal(s) individually in each profile.

like image 119
Crayon Violent Avatar answered Jan 01 '23 10:01

Crayon Violent