Track multiple top level domains in one profile

Discussion in 'Google Analytics' started by midwestbonsai, Jul 17, 2010.

  1. #1
    I have been trying for over a week to get this to work hand have no idea what I am doing wrong.

    I want to track 5 domains in one profile, I have added the following to all pages on all domains being tracked.

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
    _gaq.push(['_setDomainName', ".domainA.com'];); (changing this for each domain name)
    _gaq.push(['_setAllowLinker', true]);
    _gaq.push(['_setAllowHash', false]);
    _link();
    _linkByPost();
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    
    Code (markup):
    now nothing is being collected from any domain...

    what am I doing wrong?
     
    midwestbonsai, Jul 17, 2010 IP
  2. atxsurf

    atxsurf Peon

    Messages:
    2,394
    Likes Received:
    21
    Best Answers:
    1
    Trophy Points:
    0
    #2
    i don't think you have to mess with analytics code to track multiple domains - it supports it by itself
     
    atxsurf, Jul 17, 2010 IP
  3. createdevelop

    createdevelop Well-Known Member

    Messages:
    267
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    140
    #3
    The domain name in the code is only about linking it to the profile in your account. You should be able to use the same code to track all the pages you want on the same profile.
     
    createdevelop, Jul 18, 2010 IP
  4. scotman

    scotman Active Member

    Messages:
    212
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    55
    #4
    You are right on, no need to do any fancy code simply add the domain profile to your list of domains your tracking and grab the code from Google Analytics.

    Not sure why you want to track separate domains under one domain name which if that is what you are trying to do then I don't think it can be done. Multiply domains each under their own profile on one GA account is the way it is supposed to work.

    What I mean by "if you are wanting to track one domain" is using the GA code on multiply pages of that domain. If you are wanting to track totally different domains which for example would be tracking test.com and pass.com under the same profile then from what I gather it can not be done. In this case you would have to create two distinct profiles under your GA account.

    But if you want to track test.com and test.com/blog and test.com/news then simply add the code GA gave you for that main domain to all of the proceeding pages. Then again you can also track these separately too to get even better results with GA. It can be done by creating separate profiles for test.com and test.com/news.

    Now if your provide us more specific information we might be able help you even further. Like where did you put the GA code? What type of cms are you using eg..WordPress, Joomla ect? Your domain names your trying to apply the code to?
     
    scotman, Jul 19, 2010 IP
  5. Kelso

    Kelso Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    some people recommend against using the same profile for multiple sites.. as people can spy on you and see which sites are using the same ID.. especially if you are going to interlink them.
     
    Kelso, Jul 19, 2010 IP
  6. imperialDirectory

    imperialDirectory Peon

    Messages:
    395
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I had been tracking multiple domains with 70+ sites and individual sites as well. Here's the code I use:

    
        var _gaq = _gaq || [];
        
        _gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
        _gaq.push(['_trackPageview']);
        _gaq.push(['b._setAccount', 'UA-xxxxxxxx-x']);
        _gaq.push(['b._setDomainName', 'none']);
        _gaq.push(['b._setAllowLinker', true]);
        _gaq.push(['b._trackPageview']);
        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
        })();
    
    Code (markup):
    The first code is for single domain. The second code "b." is for all domains. (Sample site is in my signature if you need. You can use "view source" and the tracking code is right under <body> tag
     
    imperialDirectory, Jul 20, 2010 IP